Class: Twostroke::Runtime::Types::BooleanObject
- Defined in:
- lib/twostroke/runtime/types/boolean_object.rb
Instance Attribute Summary collapse
-
#boolean ⇒ Object
readonly
Returns the value of attribute boolean.
Attributes inherited from Object
#_class, #accessors, #data, #extensible, #properties, #prototype
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(boolean) ⇒ BooleanObject
constructor
A new instance of BooleanObject.
- #to_ruby ⇒ Object
Methods inherited from Object
#can_put, #construct, #constructing?, #default_value, #define_own_property, #delete, #delete!, #each_enumerable_property, #generic_items, #get, #get_own_property, #get_property, #has_accessor, #has_own_property, #has_property, #proto_put, #put, set_global_prototype, #typeof
Methods inherited from Value
Constructor Details
#initialize(boolean) ⇒ BooleanObject
Returns a new instance of BooleanObject.
15 16 17 18 19 |
# File 'lib/twostroke/runtime/types/boolean_object.rb', line 15 def initialize(boolean) @prototype = BooleanObject.constructor_function.get("prototype") super() @boolean = boolean end |
Instance Attribute Details
#boolean ⇒ Object (readonly)
Returns the value of attribute boolean.
14 15 16 |
# File 'lib/twostroke/runtime/types/boolean_object.rb', line 14 def boolean @boolean end |
Class Method Details
.constructor_function ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/twostroke/runtime/types/boolean_object.rb', line 3 def self.constructor_function @@constructor_function ||= Function.new(->(scope, this, args) { if this.constructing? Twostroke::Runtime::Types.to_object(Twostroke::Runtime::Types.to_boolean(args[0] || Undefined.new)) else Twostroke::Runtime::Types.to_boolean(args[0]) end }, nil, "Boolean", []) end |
Instance Method Details
#to_ruby ⇒ Object
21 22 23 |
# File 'lib/twostroke/runtime/types/boolean_object.rb', line 21 def to_ruby boolean end |