Class: Spark::JavaBridge::JRuby

Inherits:
Base
  • Object
show all
Defined in:
lib/spark/java_bridge/jruby.rb

Constant Summary

Constants inherited from Base

Base::JAVA_OBJECTS, Base::JAVA_TEST_OBJECTS, Base::RUBY_TO_JAVA_SKIP

Instance Method Summary collapse

Methods inherited from Base

#call, #import_all, #import_all_test, #to_java, #to_java_array_list, #to_long, #to_ruby

Methods included from Helper::System

included

Constructor Details

#initialize(*args) ⇒ JRuby

Returns a new instance of JRuby.



7
8
9
10
# File 'lib/spark/java_bridge/jruby.rb', line 7

def initialize(*args)
  super
  jars.each {|jar| require jar}
end

Instance Method Details

#import(name, klass) ⇒ Object



12
13
14
15
16
17
# File 'lib/spark/java_bridge/jruby.rb', line 12

def import(name, klass)
  klass = "Java::#{klass}"
  Object.const_set(name, eval(klass))
rescue NameError
  raise_missing_class(klass)
end

#java_object?(object) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/spark/java_bridge/jruby.rb', line 19

def java_object?(object)
  object.is_a?(JavaProxy)
end