Class: Ubill::Line

Inherits:
Array
  • Object
show all
Defined in:
lib/ubill/line.rb

Instance Method Summary collapse

Instance Method Details

#append(item, **options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ubill/line.rb', line 3

def append(item, **options)
  unless self.empty?
    self << {text: "", character_spacing: 1.mm}
  end

  # don't know why, but sometimes there appears an additional
  # space after the item. seems to be a certain combination of
  # characters, maybe problems with UTF-8? However, if \0 is
  # appended symptom vanishes.
  options[:text] = "#{item}\0"
  self << options
end