Class: DYI::Shape::Path::VerticalLineCommand
Overview
Instance Attribute Summary
Attributes inherited from CommandBase
#point, #preceding_command
Instance Method Summary
collapse
Methods inherited from LineCommand
commands
Methods inherited from CommandBase
#absolute?, absolute_commands, #last_point, #preceding_point, #relative?, relative_commands, #start_point, #used_same_command?
Constructor Details
#initialize(relative, preceding_command, y) ⇒ VerticalLineCommand
Returns a new instance of VerticalLineCommand.
775
776
777
|
# File 'lib/dyi/shape/path.rb', line 775
def initialize(relative, preceding_command, y)
super(relative, preceding_command, Coordinate.new(relative ? 0 : preceding_command.last_point.x, y))
end
|
Instance Method Details
#instructions_char ⇒ Object
787
788
789
|
# File 'lib/dyi/shape/path.rb', line 787
def instructions_char
relative? ? 'v' : 'V'
end
|
#to_compatible_commands(preceding_command) ⇒ Object
779
780
781
|
# File 'lib/dyi/shape/path.rb', line 779
def to_compatible_commands(preceding_command)
LineCommand.new(relative?, preceding_command, @point)
end
|
#to_concise_syntax_fragments ⇒ Object
783
784
785
|
# File 'lib/dyi/shape/path.rb', line 783
def to_concise_syntax_fragments
used_same_command? ? @point.y.to_s : (instructions_char + @point.y.to_s)
end
|