Class: Rhino::Ruby::DefaultAccess
- Inherits:
-
AccessBase
- Object
- AccessBase
- Rhino::Ruby::DefaultAccess
- Extended by:
- DeprecatedAccess
- Defined in:
- lib/rhino/ruby/default_access.rb
Instance Method Summary collapse
- #get(object, name, scope) ⇒ Object
- #has(object, name, scope) ⇒ Object
- #put(object, name, value) ⇒ Object
Instance Method Details
#get(object, name, scope) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rhino/ruby/default_access.rb', line 13 def get(object, name, scope) if object.respond_to?(name_s = name.to_s) method = object.method(name_s) if method.arity == 0 return Rhino.to_javascript(method.call, scope) else return Function.wrap(method.unbind) end elsif object.respond_to?(:"#{name}=") return nil end super end |
#has(object, name, scope) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rhino/ruby/default_access.rb', line 5 def has(object, name, scope) if object.respond_to?(name.to_s) || object.respond_to?(:"#{name}=") return true end super end |