module ConceptDocFormatter

Formatter Concept to Doc

Public Class Methods

table_to_s(table) click to toggle source

Formatter Table to Doc @param table (Table) @return String

# File lib/asker/formatter/concept_doc_formatter.rb, line 29
def self.table_to_s(table)
  my_screen_table = Terminal::Table.new do |st|
    st << table.fields
    st << :separator
    table.rows.each { |r| st.add_row r }
  end
  "#{my_screen_table}\n"
end
to_s(concept) click to toggle source

Formatter Concept into Doc @param concept (Concept)

# File lib/asker/formatter/concept_doc_formatter.rb, line 14
def self.to_s(concept)
  out = ''
  out << "\n#{Rainbow(concept.name).bg(:blue).bright}\n\n"
  concept.texts.each { |i| out << "* #{i}\n" }
  out << "\n"
  concept.tables.each do |table|
    out << table_to_s(table)
  end
  out
end