Class: Rdpl::Barcode

Inherits:
Object
  • Object
show all
Includes:
Element
Defined in:
lib/elements/barcode.rb

Overview

Represents a barcode to be printed.

Constant Summary collapse

CODE_128 =
'e'
CODE_128_HUMAN =
"E"
DEFAULT_HEIGHT =
25

Constants included from Element

Element::ROTATION_0_DEGREES, Element::ROTATION_180_DEGREES, Element::ROTATION_270_DEGREES, Element::ROTATION_90_DEGREES

Instance Method Summary collapse

Methods included from Element

#column_position, #column_position=, #data, #data=, #font_id, #font_id=, #height_multiplier, #height_multiplier=, #initialize, #rotation, #rotation=, #row_position, #row_position=, #to_s, #width_multiplier, #width_multiplier=

Instance Method Details

#heightObject

Returns the barcode’s height. Defaults to 25.



23
24
25
# File 'lib/elements/barcode.rb', line 23

def height
  @height || DEFAULT_HEIGHT
end

#height=(height) ⇒ Object

Sets the barcode height. Valid values go from 0 to 999.



17
18
19
20
# File 'lib/elements/barcode.rb', line 17

def height=(height)
  raise InvalidBarcodeHeightError unless valid_height_range.include?(height)
  @height = height
end