Class: Gobstones::Lang::False

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?

Methods included from EqualityDefinition

#==, #equality_attributes

Instance Method Details

#<(other) ⇒ Object



76
77
78
# File 'lib/gobstones/lang/literals/boolean.rb', line 76

def <(other)
  self != other
end

#and(_other) ⇒ Object



80
81
82
# File 'lib/gobstones/lang/literals/boolean.rb', line 80

def and(_other)
  self
end

#if_false(block, context) ⇒ Object



97
98
99
100
# File 'lib/gobstones/lang/literals/boolean.rb', line 97

def if_false(block, context)
  block.evaluate context
  self
end

#if_true(_block, _context) ⇒ Object



92
93
94
95
# File 'lib/gobstones/lang/literals/boolean.rb', line 92

def if_true(_block, _context)
  # nothing to do, I'm false :)
  self
end

#notObject



88
89
90
# File 'lib/gobstones/lang/literals/boolean.rb', line 88

def not
  True.new
end

#or(other) ⇒ Object



84
85
86
# File 'lib/gobstones/lang/literals/boolean.rb', line 84

def or(other)
  other
end

#to_sObject



106
107
108
# File 'lib/gobstones/lang/literals/boolean.rb', line 106

def to_s
  'False'
end

#true?Boolean

Returns:



102
103
104
# File 'lib/gobstones/lang/literals/boolean.rb', line 102

def true?
  false
end