lib/svgcode/gcode/command.rb in svgcode-0.2.0 vs lib/svgcode/gcode/command.rb in svgcode-0.3.0
- old
+ new
@@ -11,11 +11,11 @@
if letter_or_str.length > 1
parts = letter_or_str.split(/\s+/)
cmd = Command.parse_single(parts.shift)
@letter = cmd.letter
@number = cmd.number
- @args = parts.collect { |arg| Command.parse_single(arg) }
+ @args = parts.collect { |arg| Command.parse_single(arg) }
else
@letter = letter_or_str
@number = number
@args = args
end
@@ -30,11 +30,11 @@
str += " #{@args.join(' ')}" unless @args.nil? || @args.empty?
str
end
def ==(other)
- other.is_a?(self.class) &&
+ other.is_a?(self.class) &&
other.letter == @letter &&
other.number.eql?(@number) &&
other.args == @args
end
@@ -59,10 +59,11 @@
number = str.length > 1 ? str[1..(str.length - 1)] : nil
Command.new(letter, number)
end
def self.comment(str)
- "\n(#{str}!!!)"
+ str.gsub!(/[()]/, '')
+ "\n(#{str})"
end
def self.absolute
Command.new(:g, 90)
end