lib/zebra/zpl/qrcode.rb in zebra-zpl-1.0.2 vs lib/zebra/zpl/qrcode.rb in zebra-zpl-1.0.5

- old
+ new

@@ -8,10 +8,14 @@ class InvalidScaleFactorError < StandardError; end class InvalidCorrectionLevelError < StandardError; end attr_reader :scale_factor, :correction_level + def width=(width) + @width = width || 0 + end + def scale_factor=(value) raise InvalidScaleFactorError unless (1..99).include?(value.to_i) @scale_factor = value end @@ -20,10 +24,10 @@ @correction_level = value end def to_zpl check_attributes - ["b#{x}", y, "Q", "s#{scale_factor}", "e#{correction_level}", "\"#{data}\""].join(",") + "^FW#{rotation}^FO#{x},#{y}^BQN,2,#{scale_factor},,3^FD#{correction_level}A,#{data}^FS" end private def check_attributes