Class: Languages::Zpl2::Barcode1D
- Inherits:
-
Object
- Object
- Languages::Zpl2::Barcode1D
- Defined in:
- lib/languages/zpl2/barcode.rb
Constant Summary collapse
- BarcodeClasses =
{ code_128: "BC", ean13: "BE" }
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.
20 21 22 23 24 25 |
# File 'lib/languages/zpl2/barcode.rb', line 20 def initialize(code_type, opts = {}) @code = BarcodeClasses[code_type] @font = opts[:font] || Font.new @human_readable = opts[:human_readable] || "Y" @text = opts[:text] || "" end |
Instance Method Details
#render ⇒ Object
27 28 29 |
# File 'lib/languages/zpl2/barcode.rb', line 27 def render "^#{@code}#{@font.rotation},#{@font.height*2},#{@human_readable},N,N^FD#{@text}^FS" end |