Class: Zebra::Zpl::Barcode

Inherits:
Object
  • Object
show all
Includes:
Printable
Defined in:
lib/zebra/zpl/barcode.rb

Defined Under Namespace

Classes: InvalidNarrowBarWidthError, InvalidWideBarWidthError

Instance Attribute Summary collapse

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

#heightObject

Returns the value of attribute height.



11
12
13
# File 'lib/zebra/zpl/barcode.rb', line 11

def height
  @height
end

#narrow_bar_widthObject

Returns the value of attribute narrow_bar_width.



12
13
14
# File 'lib/zebra/zpl/barcode.rb', line 12

def narrow_bar_width
  @narrow_bar_width
end


34
35
36
# File 'lib/zebra/zpl/barcode.rb', line 34

def print_human_readable_code
  @print_human_readable_code || false
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/zebra/zpl/barcode.rb', line 12

def type
  @type
end

#wide_bar_widthObject

Returns the value of attribute wide_bar_width.



12
13
14
# File 'lib/zebra/zpl/barcode.rb', line 12

def wide_bar_width
  @wide_bar_width
end

#widthObject

Returns the value of attribute width.



12
13
14
# File 'lib/zebra/zpl/barcode.rb', line 12

def width
  @width
end

Instance Method Details

#to_zplObject



38
39
40
41
42
# File 'lib/zebra/zpl/barcode.rb', line 38

def to_zpl
  check_attributes
  human_readable = print_human_readable_code ? "Y" : "N"
  "^FW#{rotation}^FO#{x},#{y}^BY#{narrow_bar_width}^B#{type}#{rotation},#{height},#{human_readable}^FD#{data}^FS"
end