class DYI::Shape::Path::MoveCommand
Public Class Methods
commands(relative, preceding_command, *points)
click to toggle source
# File lib/dyi/shape/path.rb, line 683 def commands(relative, preceding_command, *points) raise ArgumentError, 'wrong number of arguments (2 for 3)' if points.empty? commands = [new(relative, preceding_command, points.first)] points[1..-1].inject(commands) do |cmds, pt| cmds << LineCommand.new(relative, cmds.last, pt) end end
Public Instance Methods
instructions_char()
click to toggle source
# File lib/dyi/shape/path.rb, line 678 def instructions_char relative? ? 'm' : 'M' end
last_point()
click to toggle source
Calls superclass method
DYI::Shape::Path::CommandBase#last_point
# File lib/dyi/shape/path.rb, line 666 def last_point (relative? && preceding_command.nil?) ? point : super end
relative?()
click to toggle source
Calls superclass method
DYI::Shape::Path::CommandBase#relative?
# File lib/dyi/shape/path.rb, line 670 def relative? preceding_command.nil? ? false : super end
start_point()
click to toggle source
# File lib/dyi/shape/path.rb, line 662 def start_point last_point end
to_concise_syntax_fragments()
click to toggle source
# File lib/dyi/shape/path.rb, line 674 def to_concise_syntax_fragments instructions_char + @point.to_s end