Class: Savage::Direction

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/savage/direction.rb

Instance Method Summary collapse

Methods included from Utils

#bool_to_int

Constructor Details

#initialize(absolute) ⇒ Direction

Returns a new instance of Direction.



10
11
12
# File 'lib/savage/direction.rb', line 10

def initialize(absolute)
  @absolute = absolute
end

Instance Method Details

#absolute?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/savage/direction.rb', line 14

def absolute?
  @absolute
end

#to_commandObject



18
19
20
21
# File 'lib/savage/direction.rb', line 18

def to_command
  arr = to_a
  arr[0] + arr[1..-1].join(' ').gsub(/ -/,'-')
end