Class: Gobstones::Lang::Direction
- Inherits:
-
Literal
show all
- Defined in:
- lib/gobstones/lang/literals/direction.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
6
7
8
|
# File 'lib/gobstones/lang/literals/direction.rb', line 6
def self.all
[Norte, Sur, Este, Oeste]
end
|
.order ⇒ Object
10
11
12
|
# File 'lib/gobstones/lang/literals/direction.rb', line 10
def self.order
[Norte, Este, Sur, Oeste]
end
|
Instance Method Details
#<(other) ⇒ Object
14
15
16
|
# File 'lib/gobstones/lang/literals/direction.rb', line 14
def <(other)
self.class.order.index(self.class) < self.class.order.index(other.class)
end
|
#return_type ⇒ Object
18
19
20
|
# File 'lib/gobstones/lang/literals/direction.rb', line 18
def return_type
:Direction
end
|