Sha256: 3d9aad6d121c73f716825c4bb0c9e5acf1118f52bc6ae479ed9a5d858934e562

Contents?: true

Size: 506 Bytes

Versions: 6

Compression:

Stored size: 506 Bytes

Contents

require 'terminal-table'

module VagrantPlugins
  module Openstack
    module Command
      module Utils
        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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-openstack-provider-0.7.0 lib/vagrant-openstack-provider/command/utils.rb
vagrant-openstack-provider-0.6.1 lib/vagrant-openstack-provider/command/utils.rb
vagrant-openstack-provider-0.6.0 lib/vagrant-openstack-provider/command/utils.rb
vagrant-openstack-provider-0.5.2 lib/vagrant-openstack-provider/command/utils.rb
vagrant-openstack-provider-0.5.1 lib/vagrant-openstack-provider/command/utils.rb
vagrant-openstack-provider-0.5.0 lib/vagrant-openstack-provider/command/utils.rb