Module: Tux::CommandsFormatted

Defined in:
lib/tux/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format(arr) ⇒ Object



30
31
32
33
34
35
# File 'lib/tux/commands.rb', line 30

def self.format(arr)
  arr = arr.map {|e| [e[0], e[1].inspect] }
  max1 = arr.map {|e| e[0].length }.max
  max2 = arr.map {|e| e[1].length }.max
  arr.map {|k,v| "%-*s  %-*s" % [max1, k, max2, v] }
end

Instance Method Details

#routesObject



37
38
39
# File 'lib/tux/commands.rb', line 37

def routes
  puts CommandsFormatted.format(super)
end

#settingsObject



41
42
43
# File 'lib/tux/commands.rb', line 41

def settings
  puts CommandsFormatted.format(super)
end