Class: VagrantPlugininspection::UI::Columnized
- Inherits:
-
Vagrant::UI::Colored
- Object
- Vagrant::UI::Colored
- VagrantPlugininspection::UI::Columnized
- Defined in:
- lib/vagrant-plugins/ui.rb
Defined Under Namespace
Classes: Layout, LayoutError
Instance Method Summary collapse
Instance Method Details
#print_columns(data, opts = nil, &block) ⇒ Object
Layout
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/vagrant-plugins/ui.rb', line 114 def print_columns(data, opts=nil, &block) defaults = {} opts = defaults.merge(opts ||= {}) layout = opts.delete(:layout) columns = opts.delete(:columns) layout ||= if block_given? self.layout(&block) elsif columns && !columns.empty? Layout.new(columns) else raise LayoutError, "You need to pass a layout information, either as a block or array." end rendered = layout.rows(data, opts).map { |line| (:info, line, opts) }.join("\n") # force the prefix off, we'd allready handled that opts[:prefix] = false say :info, rendered, opts end |