Class: SimpleInvoice::Emailer::TextList
- Inherits:
-
Object
- Object
- SimpleInvoice::Emailer::TextList
- Defined in:
- lib/simple_invoice/emailer/text_list.rb
Instance Method Summary collapse
- #add(label, value) ⇒ Object
-
#initialize ⇒ TextList
constructor
A new instance of TextList.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ TextList
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_s ⇒ Object
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 |