Class: Rhino::RubyObject::Prototype
- Defined in:
- lib/rhino/ruby_object.rb
Constant Summary collapse
- Generic =
new
Instance Method Summary collapse
Instance Method Details
#get(name, start) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rhino/ruby_object.rb', line 38 def get(name, start) robject = To.ruby(start) if name == "toString" return RubyFunction.new(lambda { "[Ruby #{robject.class.name}]"}) end rb_name = name.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"} if (robject.public_methods(false).include?(rb_name)) method = robject.method(rb_name) if method.arity == 0 To.javascript(method.call) else RubyFunction.new(method) end else super(name, start) end end |