Class: Thermal::Printer
- Inherits:
-
Object
- Object
- Thermal::Printer
- Extended by:
- Forwardable
- Defined in:
- lib/thermal/printer.rb
Constant Summary collapse
- PRINT_METHODS =
TODO: align(:symbol)
i[ text hr bold underline align feed cut image qr_code ].freeze
- WRITERS =
[ ::Thermal::Escpos::Writer, ::Thermal::EscposStar::Writer, ::Thermal::Stargraphic::Writer, ::Thermal::Starprnt::Writer ].freeze
- WRITER_MAP =
::Thermal::Util.index_by(WRITERS, &:format).freeze
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
Instance Method Summary collapse
-
#initialize(device, **opts) ⇒ Printer
constructor
opts includes :cjk_encoding.
- #profile ⇒ Object
- #writer ⇒ Object
Constructor Details
#initialize(device, **opts) ⇒ Printer
opts includes :cjk_encoding
30 31 32 33 |
# File 'lib/thermal/printer.rb', line 30 def initialize(device, **opts) @device = device @opts = opts end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
27 28 29 |
# File 'lib/thermal/printer.rb', line 27 def device @device end |
Instance Method Details
#profile ⇒ Object
35 36 37 |
# File 'lib/thermal/printer.rb', line 35 def profile @profile ||= ::Thermal::Profile.new(device, **@opts) end |
#writer ⇒ Object
39 40 41 |
# File 'lib/thermal/printer.rb', line 39 def writer @writer ||= WRITER_MAP[format].new(profile) end |