Class: Savage::Direction
- Inherits:
-
Object
- Object
- Savage::Direction
- Includes:
- Transformable, Utils
- Defined in:
- lib/savage/direction.rb
Direct Known Subclasses
Savage::Directions::ClosePath, Savage::Directions::CoordinateTarget, Savage::Directions::PointTarget
Instance Method Summary collapse
- #absolute? ⇒ Boolean
-
#fully_transformable? ⇒ Boolean
Public: determine if this direction is fully transformable.
-
#initialize(absolute) ⇒ Direction
constructor
A new instance of Direction.
- #relative? ⇒ Boolean
- #to_command ⇒ Object
Methods included from Transformable
#rotate, #scale, #skew_x, #skew_y, #transform, #translate
Methods included from Utils
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
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
33 34 35 |
# File 'lib/savage/direction.rb', line 33 def fully_transformable? true end |
#relative? ⇒ Boolean
19 20 21 |
# File 'lib/savage/direction.rb', line 19 def relative? !absolute? end |
#to_command ⇒ Object
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 |