Class: Zebra::Zpl::Datamatrix
- Inherits:
-
Object
- Object
- Zebra::Zpl::Datamatrix
- Includes:
- Printable
- Defined in:
- lib/zebra/zpl/datamatrix.rb
Defined Under Namespace
Classes: InvalidFormatError, InvalidOrientationError, InvalidQualityFactorError, InvalidRatioError, InvalidSizeError
Instance Attribute Summary collapse
-
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#escape_sequence ⇒ Object
Returns the value of attribute escape_sequence.
-
#format ⇒ Object
Returns the value of attribute format.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#symbol_height ⇒ Object
Returns the value of attribute symbol_height.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes included from Printable
#data, #margin, #position, #x, #y
Instance Method Summary collapse
- #orientation ⇒ Object
- #orientation=(value) ⇒ Object
- #quality ⇒ Object
- #quality=(level) ⇒ Object
- #to_zpl ⇒ Object
Methods included from Printable
#initialize, #justification, #justification=, #rotation, #rotation=
Instance Attribute Details
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def aspect_ratio @aspect_ratio end |
#columns ⇒ Object
Returns the value of attribute columns.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def columns @columns end |
#escape_sequence ⇒ Object
Returns the value of attribute escape_sequence.
15 16 17 |
# File 'lib/zebra/zpl/datamatrix.rb', line 15 def escape_sequence @escape_sequence end |
#format ⇒ Object
Returns the value of attribute format.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def format @format end |
#rows ⇒ Object
Returns the value of attribute rows.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def rows @rows end |
#symbol_height ⇒ Object
Returns the value of attribute symbol_height.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def symbol_height @symbol_height end |
#width ⇒ Object
Returns the value of attribute width.
14 15 16 |
# File 'lib/zebra/zpl/datamatrix.rb', line 14 def width @width end |
Instance Method Details
#orientation ⇒ Object
26 27 28 |
# File 'lib/zebra/zpl/datamatrix.rb', line 26 def orientation @orientation || 'N' end |
#orientation=(value) ⇒ Object
21 22 23 24 |
# 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 ⇒ Object
39 40 41 |
# File 'lib/zebra/zpl/datamatrix.rb', line 39 def quality @quality || 200 end |
#quality=(level) ⇒ Object
34 35 36 37 |
# 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 |
#to_zpl ⇒ Object
63 64 65 66 |
# 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 |