Class: RBelly::JS::Number

Inherits:
Base
  • Object
show all
Defined in:
lib/rbelly/js/number.rb

Instance Attribute Summary

Attributes inherited from Base

#properties, #return, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #can_put?, #default_value, #delete, #has_property?, #returned?

Constructor Details

#initialize(value = 0) ⇒ Number

Returns a new instance of Number.



10
11
12
13
14
15
16
17
18
19
# File 'lib/rbelly/js/number.rb', line 10

def initialize(value = 0)
  super()
  self['MAX_VALUE'] = 1.797693134862315e+308
  self['MIN_VALUE'] = 1.0e-306
  self['NaN']       = JS::NaN.new
  self['POSITIVE_INFINITY'] = 1.0/0.0
  self['NEGATIVE_INFINITY'] = -1.0/0.0
  self['valueOf'] = lambda { value }
  self['toString'] = value.to_s
end

Class Method Details

.create(*args) ⇒ Object



5
6
7
# File 'lib/rbelly/js/number.rb', line 5

def create(*args)
  self.new(args.first || 0)
end