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.
235 236 237 238 239 |
# File 'lib/term_utils/tab.rb', line 235 def initialize(table, io, ) @table = table @io = io @options = end |
Instance Attribute Details
#io ⇒ IO
229 230 231 |
# File 'lib/term_utils/tab.rb', line 229 def io @io end |
#options ⇒ Hash
231 232 233 |
# File 'lib/term_utils/tab.rb', line 231 def @options end |
Instance Method Details
#data(values, opts = {}) ⇒ Object
246 247 248 |
# File 'lib/term_utils/tab.rb', line 246 def data(values, opts = {}) @table.print_data(@io, values, @options.merge(opts)) end |
#header(values = nil, opts = {}) ⇒ Object
243 244 245 |
# File 'lib/term_utils/tab.rb', line 243 def header(values = nil, opts = {}) @table.print_header(@io, values, @options.merge(opts)) end |
#line ⇒ Object
240 241 242 |
# File 'lib/term_utils/tab.rb', line 240 def line @io.puts "" end |
#separator(opts = {}) ⇒ nil
Prints a separator.
254 255 256 |
# File 'lib/term_utils/tab.rb', line 254 def separator(opts = {}) @table.print_separator(@io, @options.merge(opts)) end |