Sha256: a8a9e308f17156900512a9375a4f76fde7b82f5fd2e7f0d1bc8bed8ae7970cc0

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

module Gjman
  module JRuby
    class << self

      def initialize
        @initialized ||= (
          include Java
          Gjman::JAVA_LIBS.join(':').split(':').each{|jar| require jar }
          $CLASSPATH << Gjman.root('gjman','java_hacks')
          java_import 'ForbidSystemExit'
          true
        )
      end

      def classify(klass)
        java_import klass
        Java.send(klass)
      end

      def sandbox(&block)
        initialize
        begin
          ForbidSystemExit.apply
          @result = yield
        rescue ForbidSystemExit::Exception
          @result
        ensure
          ForbidSystemExit.unapply
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gjman-0.1.0 lib/gjman/jruby.rb