Class: ServerStatus::Commands::List

Inherits:
BaseCommand show all
Defined in:
lib/server-status/commands/list.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize, #settings

Constructor Details

This class inherits a constructor from ServerStatus::Commands::BaseCommand

Instance Method Details

#performObject



4
5
6
7
8
9
10
11
12
# File 'lib/server-status/commands/list.rb', line 4

def perform
  if settings['hosts'].any?
    longest_name = settings['hosts'].map { |n, h| n.size }.max

    settings['hosts'].each do |name, host|
      puts "#{name.ljust(longest_name)}  #{host}"
    end
  end
end