Sha256: c78226e59281b9d2727edefd4334b5f90fbb608119e37f55b7689411ade42c09

Contents?: true

Size: 831 Bytes

Versions: 4

Compression:

Stored size: 831 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.version,
                container.running?
              ]
            end
          end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
percheron-0.2.3 lib/percheron/formatters/stack/table.rb
percheron-0.2.2 lib/percheron/formatters/stack/table.rb
percheron-0.2.1 lib/percheron/formatters/stack/table.rb
percheron-0.2.0 lib/percheron/formatters/stack/table.rb