Class: Savage::Direction
- Inherits:
-
Object
- Object
- Savage::Direction
- Includes:
- Transformable, Utils
- Defined in:
- lib/text2path/svg_path.rb,
lib/ext/savage/lib/savage/direction.rb
Direct Known Subclasses
Savage::Directions::ClosePath, Savage::Directions::CoordinateTarget, Savage::Directions::PointTarget
Instance Attribute Summary collapse
-
#absolute ⇒ Object
Returns the value of attribute absolute.
Instance Method Summary collapse
- #absolute? ⇒ Boolean
-
#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/ext/savage/lib/savage/direction.rb', line 11 def initialize(absolute) @absolute = absolute end |
Instance Attribute Details
#absolute ⇒ Object
Returns the value of attribute absolute.
36 37 38 |
# File 'lib/text2path/svg_path.rb', line 36 def absolute @absolute end |
Instance Method Details
#absolute? ⇒ Boolean
15 16 17 |
# File 'lib/ext/savage/lib/savage/direction.rb', line 15 def absolute? @absolute end |
#relative? ⇒ Boolean
19 20 21 |
# File 'lib/ext/savage/lib/savage/direction.rb', line 19 def relative? !absolute? end |
#to_command ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ext/savage/lib/savage/direction.rb', line 23 def to_command arr = to_a arr.map! do |x| x.to_i == x ? x.to_i : x end arr[0] + arr[1..-1].join(' ').gsub(/ -/,'-') end |