Class: Loxxy::Datatype::False
- Inherits:
-
Boolean
- Object
- BuiltinDatatype
- Boolean
- Loxxy::Datatype::False
- Includes:
- Singleton
- Defined in:
- lib/loxxy/datatype/false.rb
Overview
Class for representing a Lox false value.
Instance Attribute Summary
Attributes inherited from BuiltinDatatype
Instance Method Summary collapse
-
#==(other) ⇒ Datatype::Boolean
Check for equality of a Lox False with another Lox object.
-
#false? ⇒ TrueClass
Is this object representing a false value in Lox?.
-
#falsey? ⇒ Boolean
Is the value considered falsey in Lox? Rule: false and nil are falsey and everything else is truthy.
-
#initialize ⇒ False
constructor
Build the sole instance.
-
#truthy? ⇒ Boolean
Is the value considered truthy in Lox? Rule: false and nil are falsey and everything else is truthy.
Methods inherited from Boolean
Methods inherited from BuiltinDatatype
#!, #!=, #accept, #and, #or, #to_str
Constructor Details
#initialize ⇒ False
Build the sole instance
13 14 15 |
# File 'lib/loxxy/datatype/false.rb', line 13 def initialize super(false) end |
Instance Method Details
#==(other) ⇒ Datatype::Boolean
Check for equality of a Lox False with another Lox object
40 41 42 43 |
# File 'lib/loxxy/datatype/false.rb', line 40 def ==(other) falsey = other.kind_of?(False) || other.kind_of?(FalseClass) falsey ? True.instance : False.instance end |
#false? ⇒ TrueClass
Is this object representing a false value in Lox?
19 20 21 |
# File 'lib/loxxy/datatype/false.rb', line 19 def false? true end |
#falsey? ⇒ Boolean
Is the value considered falsey in Lox? Rule: false and nil are falsey and everything else is truthy. This test used in conditional statements (i.e. if, while)
26 27 28 |
# File 'lib/loxxy/datatype/false.rb', line 26 def falsey? true end |
#truthy? ⇒ Boolean
Is the value considered truthy in Lox? Rule: false and nil are falsey and everything else is truthy. This test used in conditional statements (i.e. if, while)
33 34 35 |
# File 'lib/loxxy/datatype/false.rb', line 33 def truthy? false end |