Class: Loxxy::Datatype::True
- Inherits:
-
Boolean
- Object
- BuiltinDatatype
- Boolean
- Loxxy::Datatype::True
- Includes:
- Singleton
- Defined in:
- lib/loxxy/datatype/true.rb
Overview
Class for representing a Lox true value.
Instance Attribute Summary
Attributes inherited from BuiltinDatatype
Instance Method Summary collapse
-
#==(other) ⇒ Datatype::Boolean
Check for equality of a Lox True with another Lox object / Ruby true.
-
#initialize ⇒ True
constructor
Build the sole instance.
-
#true? ⇒ TrueClass
Is this object representing the true value in Lox?.
Methods inherited from Boolean
Methods inherited from BuiltinDatatype
#!, #!=, #accept, #and, #falsey?, #or, #to_str, #truthy?
Constructor Details
#initialize ⇒ True
Build the sole instance
13 14 15 |
# File 'lib/loxxy/datatype/true.rb', line 13 def initialize super(true) end |
Instance Method Details
#==(other) ⇒ Datatype::Boolean
Check for equality of a Lox True with another Lox object / Ruby true
26 27 28 29 |
# File 'lib/loxxy/datatype/true.rb', line 26 def ==(other) thruthy = other.kind_of?(True) || other.kind_of?(TrueClass) thruthy ? True.instance : False.instance end |
#true? ⇒ TrueClass
Is this object representing the true value in Lox?
19 20 21 |
# File 'lib/loxxy/datatype/true.rb', line 19 def true? true end |