Module: ConceptDocFormatter
- Defined in:
- lib/asker/formatter/concept_doc_formatter.rb
Class Method Summary collapse
-
.table_to_s(table) ⇒ Object
Formatter Table to Doc.
-
.to_s(concept) ⇒ Object
Formatter Concept into Doc.
Class Method Details
.table_to_s(table) ⇒ Object
Formatter Table to Doc
25 26 27 28 29 30 31 32 |
# File 'lib/asker/formatter/concept_doc_formatter.rb', line 25 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) ⇒ Object
Formatter Concept into Doc
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/asker/formatter/concept_doc_formatter.rb', line 10 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 |