Module: VagrantPlugins::Openstack::Command::Utils

Included in:
FlavorList, FloatingIpList, ImageList, NetworkList, Reset, VolumeList
Defined in:
lib/vagrant-openstack-provider/command/utils.rb

Instance Method Summary collapse

Instance Method Details

#display_item_list(env, items) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/vagrant-openstack-provider/command/utils.rb', line 7

def display_item_list(env, items)
  rows = []
  items.each do |item|
    rows << [item.id, item.name]
  end
  display_table(env, %w(Id Name), rows)
end

#display_table(env, headers, rows) ⇒ Object



15
16
17
18
# File 'lib/vagrant-openstack-provider/command/utils.rb', line 15

def display_table(env, headers, rows)
  table = Terminal::Table.new headings: headers, rows: rows
  env[:ui].info("\n#{table}")
end