Class: LeapCli::Commands::TagTable
- Inherits:
-
Object
- Object
- LeapCli::Commands::TagTable
- Includes:
- CommandLineReporter
- Defined in:
- lib/leap_cli/commands/list.rb
Instance Method Summary collapse
-
#initialize(heading, tag_list) ⇒ TagTable
constructor
A new instance of TagTable.
- #run ⇒ Object
Constructor Details
#initialize(heading, tag_list) ⇒ TagTable
Returns a new instance of TagTable.
60 61 62 63 |
# File 'lib/leap_cli/commands/list.rb', line 60 def initialize(heading, tag_list) @heading = heading @tag_list = tag_list end |
Instance Method Details
#run ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/leap_cli/commands/list.rb', line 64 def run = @tag_list.keys.sort max_width = [20, (+[@heading]).inject(0) {|max,i| [i.size,max].max}].max table :border => false do row :header => true, :color => 'cyan' do column @heading, :align => 'right', :width => max_width column "NODES", :width => HighLine::SystemExtensions.terminal_size.first - max_width - 2, :padding => 2 end .each do |tag| row do column tag column @tag_list[tag].node_list.keys.sort.join(', ') end end end vertical_spacing end |