Class: ConsoleBuddy::Byebug::BuddyCommand
- Inherits:
-
Byebug::Command
- Object
- Byebug::Command
- ConsoleBuddy::Byebug::BuddyCommand
- Includes:
- IRB
- Defined in:
- lib/console_buddy/byebug/buddy_command.rb
Class Method Summary collapse
- .buddy ⇒ Object
-
.regexp ⇒ Object
Return a regex to match the “buddy” command input.
Instance Method Summary collapse
-
#execute ⇒ Object
Execute the command.
-
#long_description ⇒ Object
Long description shown in the ‘help <command>’ output.
-
#short_description ⇒ Object
Short description shown in the ‘help’ output.
Methods included from IRB
Methods included from Report
Methods included from HttpRequest
Methods included from CSV
Class Method Details
.buddy ⇒ Object
18 19 20 |
# File 'lib/console_buddy/byebug/buddy_command.rb', line 18 def self.buddy ::ConsoleBuddy::Base.new end |
.regexp ⇒ Object
Return a regex to match the “buddy” command input.
Example: buddy.ping “example.com”
14 15 16 |
# File 'lib/console_buddy/byebug/buddy_command.rb', line 14 def self.regexp /^\s*buddy(?:\.(\w+))?\s*(.*)$/ end |
Instance Method Details
#execute ⇒ Object
Execute the command.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/console_buddy/byebug/buddy_command.rb', line 25 def execute method_name = @match[1] args = @match[2] if method_name result = self.class.buddy.send(method_name, *parse_args(args)) puts result else puts "Buddy command executed" end end |
#long_description ⇒ Object
Long description shown in the ‘help <command>’ output.
47 48 49 |
# File 'lib/console_buddy/byebug/buddy_command.rb', line 47 def long_description "Executes buddy commands with optional method calls, e.g., buddy.ping" end |
#short_description ⇒ Object
Short description shown in the ‘help’ output.
40 41 42 |
# File 'lib/console_buddy/byebug/buddy_command.rb', line 40 def short_description "Executes buddy commands" end |