Class: Savage::Direction

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

Instance Attribute Summary collapse

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/ext/savage/lib/savage/direction.rb', line 11

def initialize(absolute)
  @absolute = absolute
end

Instance Attribute Details

#absoluteObject

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

Returns:

  • (Boolean)


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

def absolute?
  @absolute
end

#relative?Boolean

Returns:

  • (Boolean)


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

def relative?
  !absolute?
end

#to_commandObject



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