Class: Java::OrgMozillaJavascript::NativeObject
- Defined in:
- lib/rhino/rhino_ext.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#[]=(key, value) ⇒ Object
re-implement unsupported Map#put.
Instance Method Details
#[](name) ⇒ Object
135 136 137 138 139 140 141 142 |
# File 'lib/rhino/rhino_ext.rb', line 135 def [](name) value = Rhino.to_ruby(ScriptableObject.getProperty(self, s_name = name.to_s)) # handle { '5': 5 }.keys() ... [ 5 ] not [ '5' ] ! if value.nil? && (i_name = s_name.to_i) != 0 value = Rhino.to_ruby(ScriptableObject.getProperty(self, i_name)) end value end |
#[]=(key, value) ⇒ Object
re-implement unsupported Map#put
145 146 147 148 |
# File 'lib/rhino/rhino_ext.rb', line 145 def []=(key, value) scope = self ScriptableObject.putProperty(self, key.to_s, Rhino.to_javascript(value, scope)) end |