Class: Gobstones::Lang::Color
- Inherits:
-
Literal
show all
- Defined in:
- lib/gobstones/lang/literals/color.rb
Constant Summary
Constants inherited
from Literal
Literal::OPERATORS_MAPPING
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Literal
#<=>, #==, #evaluate, #if_false, #if_true, #not, #same_type_as, #true?
Methods inherited from Expression
#evaluate, #is_function_call?
#==, #equality_attributes
Class Method Details
.all ⇒ Object
7
8
9
|
# File 'lib/gobstones/lang/literals/color.rb', line 7
def self.all
[Azul, Negro, Rojo, Verde]
end
|
.order ⇒ Object
11
12
13
|
# File 'lib/gobstones/lang/literals/color.rb', line 11
def self.order
[Azul, Negro, Rojo, Verde]
end
|
Instance Method Details
#<(other) ⇒ Object
15
16
17
|
# File 'lib/gobstones/lang/literals/color.rb', line 15
def <(other)
self.class.order.index(self.class) < self.class.order.index(other.class)
end
|
#opposite ⇒ Object
19
20
21
|
# File 'lib/gobstones/lang/literals/color.rb', line 19
def opposite
raise Runner::GobstonesTypeError, "colors don't have opposite"
end
|
#return_type ⇒ Object
23
24
25
|
# File 'lib/gobstones/lang/literals/color.rb', line 23
def return_type
:Color
end
|