Class: Rhino::RubyObject

Inherits:
J::ScriptableObject
  • Object
show all
Includes:
J::Wrapper
Defined in:
lib/rhino/ruby_object.rb

Defined Under Namespace

Classes: Prototype

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ RubyObject

Returns a new instance of RubyObject.



6
7
8
9
# File 'lib/rhino/ruby_object.rb', line 6

def initialize(object)
  super()
  @ruby = object
end

Instance Method Details

#getClassNameObject



15
16
17
# File 'lib/rhino/ruby_object.rb', line 15

def getClassName()
  @ruby.class.name
end

#getIdsObject



32
33
34
# File 'lib/rhino/ruby_object.rb', line 32

def getIds()
  @ruby.public_methods(false).map {|m| m.gsub(/(.)_(.)/) {java.lang.String.new("#{$1}#{$2.upcase}")}}.to_java
end

#getPrototypeObject Also known as: prototype



19
20
21
# File 'lib/rhino/ruby_object.rb', line 19

def getPrototype()
  Prototype::Generic
end

#put(key, start, value) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/rhino/ruby_object.rb', line 23

def put(key, start, value)
  if @ruby.respond_to?("#{key}=")
    @ruby.send("#{key}=", To.ruby(value))
    value
  else
    super
  end
end

#to_sObject



36
37
38
# File 'lib/rhino/ruby_object.rb', line 36

def to_s
  "[Native #{@ruby.class.name}]"
end

#unwrapObject



11
12
13
# File 'lib/rhino/ruby_object.rb', line 11

def unwrap
  @ruby
end