Module: Tux::CommandsFormatted

Defined in:
lib/tux/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format(arr) ⇒ Object



32
33
34
35
36
37
# File 'lib/tux/commands.rb', line 32

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



39
40
41
# File 'lib/tux/commands.rb', line 39

def routes
  puts CommandsFormatted.format(super)
end

#settingsObject



43
44
45
# File 'lib/tux/commands.rb', line 43

def settings
  puts CommandsFormatted.format(super)
end