Class: Java::OrgMozillaJavascript::NativeObject
- Defined in:
- lib/rhino/rhino_ext.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](name) ⇒ Object
-
#[]=(key, value) ⇒ Object
re-implement unsupported Map#put.
-
#eql?(other) ⇒ Boolean
NOTE: need to re-implement this as JRuby 1.7.1 seems to be not routing to super.
Instance Method Details
#==(other) ⇒ Object
158 159 160 161 162 163 164 165 166 167 |
# File 'lib/rhino/rhino_ext.rb', line 158 def ==(other) return true if super if other.is_a?(Hash) || other.is_a?(java.util.Map) for key, val in other return false if self[key] != val end return true end false end |
#[](name) ⇒ Object
143 144 145 146 147 148 149 150 |
# File 'lib/rhino/rhino_ext.rb', line 143 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
153 154 155 156 |
# File 'lib/rhino/rhino_ext.rb', line 153 def []=(key, value) scope = self ScriptableObject.putProperty(self, key.to_s, Rhino.to_javascript(value, scope)) end |
#eql?(other) ⇒ Boolean
NOTE: need to re-implement this as JRuby 1.7.1 seems to be not routing to super
170 171 172 |
# File 'lib/rhino/rhino_ext.rb', line 170 def eql?(other) # :nodoc self.class == other.class && self.==(other) end |