Class: VagrantPlugininspection::UI::Columnized

Inherits:
Vagrant::UI::Colored
  • Object
show all
Defined in:
lib/vagrant-plugins/ui.rb

Instance Method Summary collapse

Instance Method Details



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant-plugins/ui.rb', line 11

def print_columns(data, opts=nil)
  defaults = { :prefix => false }
  opts     = defaults.merge(opts ||= {})

  columns = opts.delete(:column_order)

  data = clean(data, opts)
  size = sizes(data)

  table_head = columnize_row(columns.zip(columns), size, columns) + "\n" 
  table_head << (table_head.gsub(/[^\t]/, '-')) + "\n"
  table_body = data.map { |line| columnize_row(line, size, columns) }.join("\n")
  
  say :info, table_head << table_body, opts
end

#say(type, message, opts = nil) ⇒ Object



5
6
7
8
9
# File 'lib/vagrant-plugins/ui.rb', line 5

def say(type, message, opts=nil)
  defaults = { :new_line => true, :prefix => true }
  opts     = defaults.merge(opts || {})
  super
end