class Gobstones::Lang::Literal

Constants

OPERATORS_MAPPING

Public Instance Methods

<(_other) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 31
def <(_other)
  subclass_responsibility
end
<=>(other) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 24
def <=>(other)
  return 0 if self == other
  return -1 if self < other

  1
end
==(other) click to toggle source

TODO EqualityDefinition module seems to fail used with Comparable

# File lib/gobstones/lang/literals/literal.rb, line 18
def ==(other)
  self.class == other.class
end
Also aliased as: eql?
eql?(other)
Alias for: ==
evaluate(_context) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 12
def evaluate(_context)
  self
end
if_false(_block, _context) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 62
def if_false(_block, _context)
  not_boolean_type_error
end
if_true(_block, _context) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 58
def if_true(_block, _context)
  not_boolean_type_error
end
not() click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 70
def not
  not_boolean_type_error
end
return_type() click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 54
def return_type
  subclass_responsibility
end
same_type_as(other) click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 50
def same_type_as(other)
  return_type == other.return_type
end
true?() click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 66
def true?
  not_boolean_type_error
end

Private Instance Methods

not_boolean_type_error() click to toggle source
# File lib/gobstones/lang/literals/literal.rb, line 76
def not_boolean_type_error
  raise Runner::GobstonesTypeError, "#{self} is not a boolean"
end