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 = {}) ⇒ Object
- #header(values = nil, opts = {}) ⇒ Object
-
#initialize(table, io, options) ⇒ Printer
constructor
A new instance of Printer.
- #line ⇒ Object
-
#separator(opts = {}) ⇒ nil
Prints a separator.
Constructor Details
#initialize(table, io, options) ⇒ Printer
Returns a new instance of Printer.
248 249 250 251 252 |
# File 'lib/term_utils/tab.rb', line 248 def initialize(table, io, ) @table = table @io = io @options = end |
Instance Attribute Details
#io ⇒ IO
242 243 244 |
# File 'lib/term_utils/tab.rb', line 242 def io @io end |
#options ⇒ Hash
244 245 246 |
# File 'lib/term_utils/tab.rb', line 244 def @options end |
Instance Method Details
#data(values, opts = {}) ⇒ Object
259 260 261 |
# File 'lib/term_utils/tab.rb', line 259 def data(values, opts = {}) @table.print_data(@io, values, @options.merge(opts)) end |
#header(values = nil, opts = {}) ⇒ Object
256 257 258 |
# File 'lib/term_utils/tab.rb', line 256 def header(values = nil, opts = {}) @table.print_header(@io, values, @options.merge(opts)) end |
#line ⇒ Object
253 254 255 |
# File 'lib/term_utils/tab.rb', line 253 def line @io.puts "" end |
#separator(opts = {}) ⇒ nil
Prints a separator.
267 268 269 |
# File 'lib/term_utils/tab.rb', line 267 def separator(opts = {}) @table.print_separator(@io, @options.merge(opts)) end |