Class: TermUtils::Tab::Printer
- Inherits:
-
Object
- Object
- TermUtils::Tab::Printer
- Defined in:
- lib/term_utils/tab.rb
Overview
Represents a table printer.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#data(values, opts = {}) ⇒ nil
Prints a data row.
-
#header(values = nil, opts = {}) ⇒ nil
Prints a header row.
-
#initialize(table, io, options) ⇒ Printer
constructor
A new instance of Printer.
-
#line ⇒ Object
Prints an empty line.
-
#separator(opts = {}) ⇒ nil
Prints a separator.
Constructor Details
#initialize(table, io, options) ⇒ Printer
Returns a new instance of Printer.
250 251 252 253 254 |
# File 'lib/term_utils/tab.rb', line 250 def initialize(table, io, ) @table = table @io = io @options = end |
Instance Attribute Details
#io ⇒ IO
244 245 246 |
# File 'lib/term_utils/tab.rb', line 244 def io @io end |
#options ⇒ Hash
246 247 248 |
# File 'lib/term_utils/tab.rb', line 246 def @options end |
Instance Method Details
#data(values, opts = {}) ⇒ nil
Prints a data row.
274 275 276 |
# File 'lib/term_utils/tab.rb', line 274 def data(values, opts = {}) @table.print_data(@io, values, @options.merge(opts)) end |
#header(values = nil, opts = {}) ⇒ nil
Prints a header row.
265 266 267 |
# File 'lib/term_utils/tab.rb', line 265 def header(values = nil, opts = {}) @table.print_header(@io, values, @options.merge(opts)) end |
#line ⇒ Object
Prints an empty line.
256 257 258 |
# File 'lib/term_utils/tab.rb', line 256 def line @io.puts "" end |
#separator(opts = {}) ⇒ nil
Prints a separator.
282 283 284 |
# File 'lib/term_utils/tab.rb', line 282 def separator(opts = {}) @table.print_separator(@io, @options.merge(opts)) end |