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
168 169 170 171 172 173 174 175 176 177 |
# File 'lib/rhino/rhino_ext.rb', line 168 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
153 154 155 156 157 158 159 160 |
# File 'lib/rhino/rhino_ext.rb', line 153 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
163 164 165 166 |
# File 'lib/rhino/rhino_ext.rb', line 163 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
180 181 182 |
# File 'lib/rhino/rhino_ext.rb', line 180 def eql?(other) # :nodoc self.class == other.class && self.==(other) end |