Module: ConceptDocFormatter
- Defined in:
- lib/asker/formatter/concept_doc_formatter.rb
Overview
Formatter Concept to Doc
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
29 30 31 32 33 34 35 36 |
# 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) ⇒ Object
Formatter Concept into Doc
14 15 16 17 18 19 20 21 22 23 |
# 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 |