Example #1
0
    private static IRubyObject wrapBlock(ThreadContext context, RubyGzipFile instance, Block block)
        throws IOException {
      if (block.isGiven()) {
        try {
          block.yield(context, instance);

          return instance.getRuntime().getNil();
        } finally {
          if (!instance.isClosed()) instance.close();
        }
      }

      return instance;
    }