Class: Savage::Direction

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

Instance Method Summary collapse

Methods included from Transformable

#rotate, #scale, #skew_x, #skew_y, #transform, #translate

Methods included from Utils

#bool_to_int

Constructor Details

#initialize(absolute) ⇒ Direction

Returns a new instance of Direction.



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

def initialize(absolute)
  @absolute = absolute
end

Instance Method Details

#absolute?Boolean

Returns:

  • (Boolean)


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

def absolute?
  @absolute
end

#fully_transformable?Boolean

Public: determine if this direction is fully transformable.

A fully transformable directions can accept any
transform including rotate.

Returns: true by default

Returns:

  • (Boolean)


33
34
35
# File 'lib/savage/direction.rb', line 33

def fully_transformable?
  true
end

#relative?Boolean

Returns:

  • (Boolean)


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

def relative?
  !absolute?
end

#to_commandObject



23
24
25
26
# File 'lib/savage/direction.rb', line 23

def to_command
  arr = to_a
  arr[0] + arr[1..-1].map {|i| to_short_f(i)}.join(' ').gsub(/ -/,'-')
end