Class: Gobstones::Lang::True
- Inherits:
-
Boolean
show all
- Defined in:
- lib/gobstones/lang/literals/boolean.rb
Constant Summary
Constants inherited
from Literal
Literal::OPERATORS_MAPPING
Instance Method Summary
collapse
Methods inherited from Boolean
#next, #opposite, #previous, #return_type
Methods inherited from Literal
#<=>, #==, #evaluate, #return_type, #same_type_as
Methods inherited from Expression
#evaluate, #is_function_call?
#==, #equality_attributes
Instance Method Details
#<(_other) ⇒ Object
40
41
42
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 40
def <(_other)
false
end
|
#and(other) ⇒ Object
44
45
46
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 44
def and(other)
other
end
|
#if_false(_block, _context) ⇒ Object
61
62
63
64
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 61
def if_false(_block, _context)
self
end
|
#if_true(block, context) ⇒ Object
56
57
58
59
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 56
def if_true(block, context)
block.evaluate context
self
end
|
#not ⇒ Object
52
53
54
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 52
def not
False.new
end
|
#or(_other) ⇒ Object
48
49
50
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 48
def or(_other)
self
end
|
#to_s ⇒ Object
70
71
72
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 70
def to_s
'True'
end
|
66
67
68
|
# File 'lib/gobstones/lang/literals/boolean.rb', line 66
def true?
true
end
|