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.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#narrow_bar_width ⇒ Object
Returns the value of attribute narrow_bar_width.
- #print_human_readable_code ⇒ Object
- #print_text_above ⇒ 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
#height ⇒ Object
Returns the value of attribute height.
12 13 14 |
# File 'lib/zebra/zpl/barcode.rb', line 12 def height @height end |
#mode ⇒ Object
Returns the value of attribute mode.
12 13 14 |
# File 'lib/zebra/zpl/barcode.rb', line 12 def mode @mode end |
#narrow_bar_width ⇒ Object
Returns the value of attribute narrow_bar_width.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def end |
#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 |
#print_text_above ⇒ Object
56 57 58 |
# File 'lib/zebra/zpl/barcode.rb', line 56 def print_text_above @print_text_above || false end |
#ratio ⇒ Object
Returns the value of attribute ratio.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def ratio @ratio end |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def type @type end |
#wide_bar_width ⇒ Object
Returns the value of attribute wide_bar_width.
13 14 15 |
# File 'lib/zebra/zpl/barcode.rb', line 13 def end |
Instance Method Details
#to_zpl ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/zebra/zpl/barcode.rb', line 60 def to_zpl check_attributes = case type when BarcodeType::CODE_39 # Code 39 Bar Code: ^B3o,e,h,f,g "^B3#{rotation},,,#{interpretation_line},#{interpretation_line_above}" when BarcodeType::CODE_93 # Code 93 Bar Code: ^BAo,h,f,g,e "^BA#{rotation},,#{interpretation_line},#{interpretation_line_above}" when BarcodeType::CODE_128_AUTO # Code 128 Bar Code: ^BCo,h,f,g,e,m "^BC#{rotation},,#{interpretation_line},#{interpretation_line_above},,#{mode}" when BarcodeType::CODABAR # ANSI Codabar Bar Code: ^BKo,e,h,f,g,k,l "^BK#{rotation},,,#{interpretation_line},#{interpretation_line_above}" when BarcodeType::CODE_AZTEC # Aztec Bar Code Parameters: ^B0a,b,c,d,e,f,g "^B0#{rotation},6" when BarcodeType::CODE_AZTEC_PARAMS # Aztec Bar Code Parameters: ^BOa,b,c,d,e,f,g "^BO#{rotation},6" when BarcodeType::CODE_UPS_MAXICODE # UPS MaxiCode Bar Code: ^BDm,n,t "^BD" when BarcodeType::CODE_QR # QR Code Bar Code: ^BQa,b,c,d,e "^BQ#{rotation}" when BarcodeType::CODE_UPCA # UPC-A Bar Code: ^BUo,h,f,g,e when BarcodeType::CODE_UPCE # UPC-E Bar Code: ^B9o,h,f,g,e "^B9#{rotation},,#{interpretation_line},#{interpretation_line_above}" when BarcodeType::CODE_EAN8 # EAN-8 Bar Code: ^B8o,h,f,g "^B8#{rotation},,#{interpretation_line},#{interpretation_line_above}" when BarcodeType::CODE_EAN13 # EAN-13 Bar Code: ^BEo,h,f,g "^BE#{rotation},,#{interpretation_line},#{interpretation_line_above}" else raise BarcodeType::InvalidBarcodeTypeError end "^FW#{rotation}^FO#{x},#{y}^BY#{width},#{ratio},#{height}#{barcode}^FD#{data}^FS" end |
#width ⇒ Object
20 21 22 |
# File 'lib/zebra/zpl/barcode.rb', line 20 def width @width || || || 0 end |
#width=(value) ⇒ Object
16 17 18 |
# File 'lib/zebra/zpl/barcode.rb', line 16 def width=(value) @width = value || 0 end |