class Java::OrgMozillaJavascript::NativeObject

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# 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) click to toggle source
# 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) click to toggle source

re-implement unsupported Map#put

# 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) click to toggle source

NOTE: need to re-implement this as JRuby 1.7.1 seems to be not routing to super

# File lib/rhino/rhino_ext.rb, line 180
def eql?(other) # :nodoc
  self.class == other.class && self.==(other)
end