Class: Languages::Epl2::Barcode2D

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

Constant Summary collapse

BarcodeClasses =
{
 data_matrix: ["D",16,16]
}

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Barcode2D.



37
38
39
40
41
42
43
# File 'lib/languages/epl2/barcode.rb', line 37

def initialize(code_type, opts = {})
  @font = opts[:font] || Font.new
  @type,@columns_encode,@rows_encode = BarcodeClasses[code_type]
  @x = (opts[:at] || [0,0])[0]
  @y = (opts[:at] || [0,0])[1]
  @text = opts[:text] || ""        
end

Instance Method Details

#renderObject



45
46
47
# File 'lib/languages/epl2/barcode.rb', line 45

def render
  "b#{@x},#{@y},#{@type},c#{@columns_encode},r#{@rows_encode},\"#{@text}\""
end