Class: SimpleInvoice::Emailer::TextList

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_invoice/emailer/text_list.rb

Instance Method Summary collapse

Constructor Details

#initializeTextList

Returns a new instance of TextList.



7
8
9
10
11
12
13
# File 'lib/simple_invoice/emailer/text_list.rb', line 7

def initialize
  @table = Text::Table.new :horizontal_padding    => 1,
                           :vertical_boundary     => ' ',
                           :horizontal_boundary   => ' ',
                           :boundary_intersection => ' '
  @table.rows = []
end

Instance Method Details

#add(label, value) ⇒ Object



15
16
17
# File 'lib/simple_invoice/emailer/text_list.rb', line 15

def add label, value
  @table.rows << [{:value => "#{label}:", :align => :right}, value.to_s]
end

#to_sObject



19
20
21
# File 'lib/simple_invoice/emailer/text_list.rb', line 19

def to_s
  reduce_gap(unindent(remove_empty_lines(@table.to_s))) + "\n"
end