class DYI::Shape::Path::LineCommand

Public Class Methods

commands(relative, preceding_command, *points) click to toggle source
# File lib/dyi/shape/path.rb, line 745
def commands(relative, preceding_command, *points)
  raise ArgumentError, 'wrong number of arguments (2 for 3)' if points.empty?
  cmd = preceding_command
  points.inject([]) do |cmds, pt|
    cmds << (cmd = new(relative, cmd, pt))
  end
end
new(relative, preceding_command, point) click to toggle source
Calls superclass method DYI::Shape::Path::CommandBase::new
# File lib/dyi/shape/path.rb, line 731
def initialize(relative, preceding_command, point)
  raise ArgumentError, 'preceding_command is nil' if preceding_command.nil?
  super
end

Public Instance Methods

instructions_char() click to toggle source
# File lib/dyi/shape/path.rb, line 740
def instructions_char
  relative? ? 'l' : 'L'
end
to_concise_syntax_fragments() click to toggle source
# File lib/dyi/shape/path.rb, line 736
def to_concise_syntax_fragments
  used_same_command? ? @point.to_s : (instructions_char + @point.to_s)
end