Class: Cure::Export::TerminalProcessor
- Inherits:
-
BaseProcessor
- Object
- BaseProcessor
- Cure::Export::TerminalProcessor
- Defined in:
- lib/cure/export/base_processor.rb
Instance Attribute Summary collapse
-
#limit_rows ⇒ Object
readonly
Returns the value of attribute limit_rows.
-
#processed ⇒ Object
readonly
Returns the value of attribute processed.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Attributes inherited from BaseProcessor
Instance Method Summary collapse
Methods inherited from BaseProcessor
Methods included from Log
#log_debug, #log_error, #log_info, #log_trace, #log_warn
Constructor Details
This class inherits a constructor from Cure::Export::BaseProcessor
Instance Attribute Details
#limit_rows ⇒ Object (readonly)
Returns the value of attribute limit_rows.
47 48 49 |
# File 'lib/cure/export/base_processor.rb', line 47 def limit_rows @limit_rows end |
#processed ⇒ Object (readonly)
Returns the value of attribute processed.
47 48 49 |
# File 'lib/cure/export/base_processor.rb', line 47 def processed @processed end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
47 48 49 |
# File 'lib/cure/export/base_processor.rb', line 47 def table @table end |
Instance Method Details
#cleanup ⇒ Object
68 69 70 |
# File 'lib/cure/export/base_processor.rb', line 68 def cleanup puts @table end |
#process(row) ⇒ Object
49 50 51 52 |
# File 'lib/cure/export/base_processor.rb', line 49 def process(row) @table.headings = row.keys if @processed.zero? @table.add_row(row.values) end |
#setup ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cure/export/base_processor.rb', line 54 def setup # Markdown mode Terminal::Table::Style.defaults = { border_top: false, border_bottom: false, border_x: "-", border_y: "|", border_i: "|" } log_info "Exporting [#{@named_range}] to terminal." @table = Terminal::Table.new(title: @opts[:title] || "<No Title Set>") end |