Class: Languages::Epl2::Barcode1D
- Inherits:
-
Object
- Object
- Languages::Epl2::Barcode1D
- 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
-
#initialize(code_type, opts = {}) ⇒ Barcode1D
constructor
A new instance of Barcode1D.
- #render ⇒ Object
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
#render ⇒ Object
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 |