acquia/moonshot

View on GitHub
lib/moonshot/stack_list_printer.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Moonshot
  class StackListPrinter
    attr_accessor :stacks

    def initialize(stacks)
      @stacks = stacks
      @table = UnicodeTable.new('Environment List')
    end

    def print
      rows = @stacks.map do |stack|
        [stack.name, stack.creation_time, stack.status]
      end

      @table.add_table(rows)

      @table.draw
      @table.draw_children
    end
  end
end