Class: Tableview::Output::ASCII

Inherits:
Object
  • Object
show all
Defined in:
lib/tableview/output/ascii.rb

Instance Method Summary collapse

Instance Method Details

#process(tv) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tableview/output/ascii.rb', line 4

def process(tv)
  @table = ""
  tv.subtables.each do |sub|
    @table << "# #{sub.title}" unless sub.title.blank?
    @table << table { |t|
      sub.parts.each do |part|
        part.rows.each do |row|
          t.add_row row.cells.map {|cell| {:value => cell.contents}.merge(cell.options) }
        end
        t.add_separator unless part == sub.parts.last
      end
    }.to_s
  end
end

#to_sObject



19
20
21
# File 'lib/tableview/output/ascii.rb', line 19

def to_s
  @table
end