Class: DYI::Shape::Path::VerticalLineCommand

Inherits:
LineCommand show all
Defined in:
lib/dyi/shape/path.rb

Overview

Since:

  • 0.0.0

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.

Since:

  • 0.0.0



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_charObject

Since:

  • 0.0.0



787
788
789
# File 'lib/dyi/shape/path.rb', line 787

def instructions_char
  relative? ? 'v' : 'V'
end

#to_compatible_commands(preceding_command) ⇒ Object

Since:

  • 0.0.0



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_fragmentsObject

Since:

  • 0.0.0



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