Class: Zebra::Zpl::Barcode
- Inherits:
-
Object
- Object
- Zebra::Zpl::Barcode
- Includes:
- Printable
- Defined in:
- lib/zebra/zpl/barcode.rb
Defined Under Namespace
Classes: InvalidNarrowBarWidthError, InvalidRatioError, InvalidWideBarWidthError
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#narrow_bar_width ⇒ Object
Returns the value of attribute narrow_bar_width.
- #print_human_readable_code ⇒ Object
-
#ratio ⇒ Object
Returns the value of attribute ratio.
-
#type ⇒ Object
Returns the value of attribute type.
-
#wide_bar_width ⇒ Object
Returns the value of attribute wide_bar_width.
Attributes included from Printable
#data, #margin, #position, #x, #y
Instance Method Summary collapse
Methods included from Printable
#initialize, #justification, #justification=, #rotation, #rotation=
Instance Attribute Details
permalink #height ⇒ Object
Returns the value of attribute height.
12 13 14 |
# File 'lib/zebra/zpl/barcode.rb', line 12 def height @height end |
permalink #narrow_bar_width ⇒ Object
Returns the value of attribute narrow_bar_width.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def @narrow_bar_width end |
permalink #print_human_readable_code ⇒ Object
52 53 54 |
# File 'lib/zebra/zpl/barcode.rb', line 52 def print_human_readable_code @print_human_readable_code || false end |
permalink #ratio ⇒ Object
Returns the value of attribute ratio.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def ratio @ratio end |
permalink #type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def type @type end |
permalink #wide_bar_width ⇒ Object
Returns the value of attribute wide_bar_width.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def @wide_bar_width end |
Instance Method Details
permalink #to_zpl ⇒ Object
[View source]
56 57 58 59 60 |
# File 'lib/zebra/zpl/barcode.rb', line 56 def to_zpl check_attributes human_readable = print_human_readable_code ? "Y" : "N" "^FW#{rotation}^FO#{x},#{y}^BY#{width},#{ratio},#{height}^B#{type}#{rotation},,#{human_readable}^FD#{data}^FS" end |
permalink #width ⇒ Object
[View source]
20 21 22 |
# File 'lib/zebra/zpl/barcode.rb', line 20 def width @width || @narrow_bar_width || @wide_bar_width || 0 end |
permalink #width=(value) ⇒ Object
[View source]
16 17 18 |
# File 'lib/zebra/zpl/barcode.rb', line 16 def width=(value) @width = value || 0 end |