Module: Quickl::Command::Delegator::ClassMethods

Defined in:
lib/quickl/command/delegator.rb

Instance Method Summary collapse

Instance Method Details

#summarized_subcommands(subs = subcommands) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/quickl/command/delegator.rb', line 37

def summarized_subcommands(subs = subcommands)
  doc = subs.collect{|cmd| 
    [cmd.command_name, cmd.overview]
  }
  max = doc.inject(0){|memo,pair| 
    l = pair.first.length
    memo > l ? memo : l
  }
  doc.collect{|pair|
    "  %-#{max}s     %s" % pair
  }.join("\n")
end