class Apollo::Formatter::TableFormatter

Public Class Methods

format(obj) click to toggle source
# File lib/apollo_crawler/formatter/table_formatter.rb, line 36
def self.format(obj)
        headings = []
        if(obj[:data].length > 0)
                headings = obj[:data][0].keys
        end

        rows = []
        obj[:data].each do |line|
                next if (line.nil? || line.empty?)
                
                data = []
                headings.each do |column|
                        data << line[column]
                end

                rows << data
        end
        
        table = Terminal::Table.new :headings => headings, :rows => rows
        return table
end

Public Instance Methods

format(obj) click to toggle source
# File lib/apollo_crawler/formatter/table_formatter.rb, line 32
def format(obj)
        return Table.format(obj)
end
name() click to toggle source
# File lib/apollo_crawler/formatter/table_formatter.rb, line 28
def name()
        return "Table"
end