lib/elements/barcode.rb in rdpl-0.1.0 vs lib/elements/barcode.rb in rdpl-0.2.0
- old
+ new
@@ -1,6 +1,7 @@
module Rdpl
+ # Represents a barcode to be printed.
class Barcode
include Element
CODE_128 = 'e'
CODE_128_HUMAN = "E"
@@ -10,14 +11,16 @@
alias :narrow_bar_multiplier :height_multiplier
alias :narrow_bar_multiplier= :height_multiplier=
DEFAULT_HEIGHT = 25
+ # Sets the barcode height. Valid values go from 0 to 999.
def height=(height)
raise InvalidBarcodeHeightError unless valid_height_range.include?(height)
@height = height
end
+ # Returns the barcode's height. Defaults to 25.
def height
@height || DEFAULT_HEIGHT
end
private