class Zebra::Zpl::Datamatrix

Attributes

aspect_ratio[R]
columns[R]
escape_sequence[RW]
format[R]
rows[R]
symbol_height[R]
width[R]

Public Instance Methods

aspect_ratio=(value) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 58
def aspect_ratio=(value)
  raise InvalidRatioError unless [1, 2].include?(value.to_i)
  @aspect_ratio = value
end
columns=(n) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 43
def columns=(n)
  raise InvalidSizeError unless (9..49).include?(n.to_i)
  @columns = n
end
format=(value) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 53
def format=(value)
  raise InvalidFormatError unless (0..6).include?(value.to_i)
  @format = value
end
orientation() click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 26
def orientation
  @orientation || 'N'
end
orientation=(value) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 21
def orientation=(value)
  raise InvalidOrientationError unless %w[N R I B].include?(value)
  @orientation = value
end
quality() click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 39
def quality
  @quality || 200
end
quality=(level) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 34
def quality=(level)
  raise InvalidQualityFactorError unless [0, 50, 80, 100, 140, 200].include?(level.to_i)
  @quality = level
end
rows=(n) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 48
def rows=(n)
  raise InvalidSizeError unless (9..49).include?(n.to_i)
  @rows = n
end
symbol_height=(height) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 30
def symbol_height=(height)
  @symbol_height = height
end
to_zpl() click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 63
def to_zpl
  check_attributes
  "^FW#{rotation}^FO#{x},#{y}^BY,,10^BX#{orientation},#{symbol_height},#{quality},#{columns},#{rows},#{format},#{escape_sequence},#{aspect_ratio}^FD#{data}^FS"
end
width=(width) click to toggle source
# File lib/zebra/zpl/datamatrix.rb, line 17
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/datamatrix.rb, line 70
def check_attributes
  super
  raise MissingAttributeError.new("the symbol height to be used is not given") unless @symbol_height
end