Class: Languages::Epl2::Barcode1D

Inherits:
Object
  • Object
show all
Defined in:
lib/languages/epl2/barcode.rb

Constant Summary collapse

BarcodeClasses =
{
 code_128: ["1",2,2,50,"B"],
 ean13: ["E30",2,2,50,"B"]
}

Instance Method Summary collapse

Constructor Details

#initialize(code_type, opts = {}) ⇒ Barcode1D

Returns a new instance of Barcode1D.



19
20
21
22
23
24
25
26
# File 'lib/languages/epl2/barcode.rb', line 19

def initialize(code_type, opts = {})
  @font = opts[:font] || Font.new
  #defaults
  @type,@nb_width,@wb_width,@height,@human_readable = BarcodeClasses[code_type]
  opts[:at] = [0,0] unless opts.has_key? :at
  @x, @y = opts[:at].pop(2)
  @text = opts[:text] || ""
end

Instance Method Details

#renderObject



28
29
30
# File 'lib/languages/epl2/barcode.rb', line 28

def render
  "B#{@x},#{@y},#{@font.rotation},#{@type},#{@nb_width},#{@wb_width},#{@height},#{@human_readable},\"#{@text}\""
end