class Nashorn::Ruby::Object
Public Class Methods
new(object)
click to toggle source
Calls superclass method
# File lib/nashorn/ruby.rb, line 123 def initialize(object) super() @unwrap = object end
wrap(object)
click to toggle source
wrap an arbitrary (ruby) object
# File lib/nashorn/ruby.rb, line 119 def self.wrap(object) Ruby.cache(object) { new(object) } end
Public Instance Methods
==(other)
click to toggle source
# File lib/nashorn/ruby.rb, line 172 def ==(other) if other.is_a?(Object) unwrap == other.unwrap else unwrap == other end end
equals(other)
click to toggle source
# File lib/nashorn/ruby.rb, line 168 def equals(other) other.is_a?(Object) && unwrap.eql?(other.unwrap) end
getClassName()
click to toggle source
@override ECMA [[Class]] property
# File lib/nashorn/ruby.rb, line 129 def getClassName @unwrap.class.to_s # to_s handles 'nameless' classes as well end
getDefaultValue(hint)
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 144 def getDefaultValue(hint) if hint && NUMBER_CLASS.eql?(hint) return hint.to_f if hint.respond_to?(:to_f) return hint.to_i if hint.respond_to?(:to_i) end @unwrap.to_s end
hashCode()
click to toggle source
# File lib/nashorn/ruby.rb, line 180 def hashCode; @unwrap.hash end
isArray()
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 153 def isArray; @unwrap.is_a?(Array) end
isFunction()
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 156 def isFunction; false end
isInstance(instance)
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 134 def isInstance(instance) instance.class.equal? @unwrap end
isInstanceOf(clazz)
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 139 def isInstanceOf(clazz) @unwrap.is_a?(clazz) end
isStrictFunction()
click to toggle source
@override
# File lib/nashorn/ruby.rb, line 159 def isStrictFunction; false end
toString()
click to toggle source
@override
def newObject(args); fail end
# File lib/nashorn/ruby.rb, line 164 def toString "[ruby #{getClassName}]" # [object User] end
to_a()
click to toggle source
Calls superclass method
# File lib/nashorn/ruby.rb, line 182 def to_a isArray ? @unwrap : super end