Sha256: 4e093d5c8c3c71a3cc0a3567f2119414f241a3ffd60b3aafa0512fc49f659ac1

Contents?: true

Size: 837 Bytes

Versions: 6

Compression:

Stored size: 837 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.containers.map do |container_name, container|
              [
                container_name,
                container.id,
                container.built_version,
                container.running?
              ]
            end
          end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
percheron-0.5.0 lib/percheron/formatters/stack/table.rb
percheron-0.4.0 lib/percheron/formatters/stack/table.rb
percheron-0.3.2 lib/percheron/formatters/stack/table.rb
percheron-0.3.1 lib/percheron/formatters/stack/table.rb
percheron-0.3.0 lib/percheron/formatters/stack/table.rb
percheron-0.2.4 lib/percheron/formatters/stack/table.rb