Class: OutputMode::Formatters::Index
- Inherits:
-
OutputMode::Formatter
- Object
- OutputMode::Formatter
- OutputMode::Formatters::Index
- Defined in:
- lib/output_mode/formatters/index.rb
Instance Attribute Summary collapse
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
Methods inherited from OutputMode::Formatter
#ascii?, build, #callables, #color?, #default, #format, #humanize?, #initialize, #no, #register, #register_all, #render, render, #time, #verbose?, #yes
Constructor Details
This class inherits a constructor from OutputMode::Formatter
Instance Attribute Details
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
30 31 32 |
# File 'lib/output_mode/formatters/index.rb', line 30 def objects @objects end |
Instance Method Details
#build_output ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/output_mode/formatters/index.rb', line 42 def build_output if humanize? opts = { renderer: ascii? ? :ascii : :unicode, header_color: header_color, row_color: row_color, colorize: color?, rotate: false, padding: [0, 1] } Outputs::Tabulated.new(*callables, **opts) else Outputs::Delimited.new(*callables, col_sep: "\t") end end |
#header_color(value = nil) ⇒ Object
32 33 34 35 |
# File 'lib/output_mode/formatters/index.rb', line 32 def header_color(value = nil) @header_color = value unless value.nil? @header_color ? @header_color : :bold end |
#row_color(value = nil) ⇒ Object
37 38 39 40 |
# File 'lib/output_mode/formatters/index.rb', line 37 def row_color(value = nil) @row_color = value unless value.nil? @row_color ? @row_color : :cyan end |