Sha256: 34bb1001f4cb385971b53968ac463b14039f6a308c2b2cbcfe7f95affc3bfb5b

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

module Rdpl
  class Barcode
    include Element

    CODE_128       = 'e'
    CODE_128_HUMAN = "E"

    alias :wide_bar_multiplier :width_multiplier
    alias :wide_bar_multiplier= :width_multiplier=
    alias :narrow_bar_multiplier :height_multiplier
    alias :narrow_bar_multiplier= :height_multiplier=

    DEFAULT_HEIGHT = 25

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

    def height
      @height || DEFAULT_HEIGHT
    end

    private
    def valid_height_range
      0..999
    end

    def formatted_height
      '%03d' % height
    end

    def valid_font_id_ranges
      [('a'.. 'z'), ('A'..'Z')]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdpl-0.1.0 lib/elements/barcode.rb