class Zebra::Zpl::Qrcode

Attributes

correction_level[R]
scale_factor[R]
width[R]

Public Instance Methods

correction_level=(value) click to toggle source
# File lib/zebra/zpl/qrcode.rb, line 22
def correction_level=(value)
  raise InvalidCorrectionLevelError unless %w[L M Q H].include?(value.to_s)
  @correction_level = value
end
scale_factor=(value) click to toggle source
# File lib/zebra/zpl/qrcode.rb, line 17
def scale_factor=(value)
  raise InvalidScaleFactorError unless (1..99).include?(value.to_i)
  @scale_factor = value
end
to_zpl() click to toggle source
# File lib/zebra/zpl/qrcode.rb, line 27
def to_zpl
  check_attributes
  "^FW#{rotation}^FO#{x},#{y}^BY,,10^BQN,2,#{scale_factor},,3^FD#{correction_level}A,#{data}^FS"
end
width=(width) click to toggle source
# File lib/zebra/zpl/qrcode.rb, line 13
def width=(width)
  @width = width || 0
end

Private Instance Methods

check_attributes() click to toggle source
Calls superclass method Zebra::Zpl::Printable#check_attributes
# File lib/zebra/zpl/qrcode.rb, line 34
def check_attributes
  super
  raise MissingAttributeError.new("the scale factor to be used is not given") unless @scale_factor
  raise MissingAttributeError.new("the error correction level to be used is not given") unless @correction_level
end