Class: Moonshot::StackParameterPrinter
- Inherits:
-
Object
- Object
- Moonshot::StackParameterPrinter
- Defined in:
- lib/moonshot/stack_parameter_printer.rb
Overview
Displays information about existing stack parameters to the user, with information on what a stack update would do.
Instance Method Summary collapse
- #format_value(value) ⇒ Object
-
#initialize(stack, table) ⇒ StackParameterPrinter
constructor
A new instance of StackParameterPrinter.
- #print ⇒ Object
Constructor Details
#initialize(stack, table) ⇒ StackParameterPrinter
Returns a new instance of StackParameterPrinter.
7 8 9 10 |
# File 'lib/moonshot/stack_parameter_printer.rb', line 7 def initialize(stack, table) @stack = stack @table = table end |
Instance Method Details
#format_value(value) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/moonshot/stack_parameter_printer.rb', line 21 def format_value(value) if value.size > 60 "#{value[0..60]}..." else value end end |
#print ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/moonshot/stack_parameter_printer.rb', line 12 def print p_table = @table.add_leaf('Stack Parameters') rows = @stack.parameters.sort.map do |key, value| ["#{key}:", format_value(value)] end p_table.add_table(rows) end |