Module: Cheri::JRuby

Defined in:
lib/cheri/jruby/jruby.rb,
lib/cheri/jruby/explorer/common.rb,
lib/cheri/jruby/explorer/splash.rb,
lib/cheri/jruby/explorer/viewer.rb,
lib/cheri/jruby/explorer/dialogs.rb

Defined Under Namespace

Modules: Explorer

Constant Summary collapse

JU =

:stopdoc:

JavaUtilities
JC =
::Java::JavaClass
RObj =
'org.jruby.RubyObject'

Class Method Summary collapse

Class Method Details

.get_class(name, proxy = true) ⇒ Object

call-seq:

get_class(class_name [,proxy=true]) -> class/interface proxy or JavaClass

Returns the proxy for the specified class or interface if proxy=true (the default); otherwise, returns the corresponding JavaClass. Getting a proxy class can be expensive (the first time it is referenced; subsequent calls retrieve it from cache). The proxy=false option is therefore provided so we can get the JavaClass, a much less expensive operation. The JavaClass cannot be instantiated, but is used in Cheri (Cheri::Swing and Cheri::AWT) for assignable_from? tests.



43
44
45
# File 'lib/cheri/jruby/jruby.rb', line 43

def get_class(name,proxy=true)
  proxy ? JU.get_proxy_class(name) : @unproxied[name] ||= JC.for_name(name)
end

.object_space?Boolean

Returns true if ObjectSpace is enabled.

Returns:

  • (Boolean)


53
54
55
# File 'lib/cheri/jruby/jruby.rb', line 53

def object_space?
  runtime.object_space_enabled?  
end

.runtimeObject

:nodoc:



46
47
48
# File 'lib/cheri/jruby/jruby.rb', line 46

def runtime #:nodoc:

  @runtime ||= ::Java.java_to_ruby(get_class(RObj,false).java_method('getRuntime').invoke(::Java.ruby_to_java(self)))
end

.start_timeObject

:nodoc:



49
50
51
# File 'lib/cheri/jruby/jruby.rb', line 49

def start_time #:nodoc:

  runtime.start_time  
end