Class: Thermal::Starprnt::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/thermal/starprnt/buffer.rb

Constant Summary collapse

COMMANDS =
i[ printRawText
printRasterReceipt
printImage
printBase64Image
print ].freeze

Instance Method Summary collapse

Instance Method Details

#flushObject



25
26
27
28
29
# File 'lib/thermal/starprnt/buffer.rb', line 25

def flush
  tmp = commands
  @commands = []
  tmp
end

print is a special command that takes an an array of subcommands



13
14
15
16
# File 'lib/thermal/starprnt/buffer.rb', line 13

def print(array)
  commands.push(print: []) if last_command != :print
  commands.last[:print] += Array.wrap(array)
end

#to_aObject



31
32
33
# File 'lib/thermal/starprnt/buffer.rb', line 31

def to_a
  commands.deep_dup
end