Class: RBelly::JS::GlobalObject
- Defined in:
- lib/rbelly/js/global_object.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ GlobalObject
constructor
A new instance of GlobalObject.
Methods inherited from Base
#[], #[]=, #can_put?, #default_value, #delete, #has_property?, #returned?
Constructor Details
#initialize ⇒ GlobalObject
Returns a new instance of GlobalObject.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rbelly/js/global_object.rb', line 4 def initialize super self['class'] = 'GlobalObject' self['NaN'] = JS::NaN.new self['NaN'].attributes << :dont_enum self['NaN'].attributes << :dont_delete self['Infinity'] = 1.0/0.0 self['Infinity'].attributes << :dont_enum self['Infinity'].attributes << :dont_delete self['undefined'] = :undefined self['undefined'].attributes << :dont_enum self['undefined'].attributes << :dont_delete self['Array'] = JS::Array.new self['Array'].function = lambda { |*args| JS::Array.create(*args) } self['Object'] = JS::Object.new self['Object'].function = lambda { |*args| JS::Object.create(*args) } self['Math'] = JS::Math.new self['Function'] = :undefined self['Function'].function = lambda { |*args| JS::Function.create(*args) } self['Number'] = JS::Number.new self['Number'].function = lambda { |*args| JS::Number.create(*args) } self['Boolean'] = JS::Boolean.new self['Boolean'].function = lambda { |*args| JS::Boolean.create(*args) } self['String'] = JS::String.new('') self['String'].function = lambda { |*args| JS::String.create(*args) } end |