class Commander::HelpFormatter::ProgramContext
Public Instance Methods
decorate_binding(bind)
click to toggle source
# File lib/commander/help_formatters.rb, line 23 def decorate_binding(bind) bind.eval("max_command_length = #{max_command_length(bind)}") bind.eval("max_aliases_length = #{max_aliases_length(bind)}") end
max_aliases_length(bind)
click to toggle source
# File lib/commander/help_formatters.rb, line 32 def max_aliases_length(bind) max_key_length(bind.eval('@aliases')) end
max_command_length(bind)
click to toggle source
# File lib/commander/help_formatters.rb, line 28 def max_command_length(bind) max_key_length(bind.eval('@commands')) end
max_key_length(hash, default = 20)
click to toggle source
# File lib/commander/help_formatters.rb, line 36 def max_key_length(hash, default = 20) longest = hash.keys.max_by(&:size) longest ? longest.size : default end