Sha256: ed8fdc4d4ece650dad7dbcadfe6d3b06ac439797bc5109c5b720f98dbd8c1159

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

module Percheron
  module Formatters
    module Stack
      class Table

        def initialize(stack)
          @stack = stack
        end

        def generate
          Terminal::Table.new(
            title:    stack.name,
            headings: headings,
            rows:     rows
          )
        end

        private

          attr_reader :stack

          def headings
            [
              'Container name',
              'ID',
              'Version',
              'Running?'
            ]
          end

          def rows
            stack.filter_containers.map do |container_name, container|
              [
                container_name,
                container.id,
                container.built_version,
                container.running?
              ]
            end
          end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
percheron-0.6.4 lib/percheron/formatters/stack/table.rb
percheron-0.6.3 lib/percheron/formatters/stack/table.rb
percheron-0.6.2 lib/percheron/formatters/stack/table.rb
percheron-0.6.1 lib/percheron/formatters/stack/table.rb
percheron-0.6.0 lib/percheron/formatters/stack/table.rb