Module: Byebug::CommandFunctions
- Defined in:
- lib/byebug/command.rb
Instance Method Summary collapse
-
#find(subcmds, param) ⇒ Object
Find param in subcmds.
-
#format_subcmds(subcmds) ⇒ Object
Build formatted list of subcmds.
-
#pad_with_dots(string) ⇒ Object
Pad a string with dots at the end to fit :width setting.
Instance Method Details
#find(subcmds, param) ⇒ Object
Find param in subcmds.
the subcommands.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/byebug/command.rb', line 23 def find(subcmds, param) param.downcase! for try_subcmd in subcmds do if (param.size >= try_subcmd.min) and (try_subcmd.name[0..param.size-1] == param) return try_subcmd end end return nil end |
#format_subcmds(subcmds) ⇒ Object
Build formatted list of subcmds
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/byebug/command.rb', line 37 def format_subcmds(subcmds) cmd_name = self.class.names.join("|") s = "\n" \ "--\n" \ "List of \"#{cmd_name}\" subcommands:\n" \ "--\n" for subcmd in subcmds do s += "#{cmd_name} #{subcmd.name} -- #{subcmd.short_help}\n" end return s end |