Class: Moonshot::StackListPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/moonshot/stack_list_printer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stacks) ⇒ StackListPrinter

Returns a new instance of StackListPrinter.



7
8
9
10
# File 'lib/moonshot/stack_list_printer.rb', line 7

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

Instance Attribute Details

#stacksObject

Returns the value of attribute stacks.



5
6
7
# File 'lib/moonshot/stack_list_printer.rb', line 5

def stacks
  @stacks
end

Instance Method Details



12
13
14
15
16
17
18
19
20
21
# File 'lib/moonshot/stack_list_printer.rb', line 12

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