Method: Aruba::CommandMonitor#find

Defined in:
lib/aruba/command_monitor.rb

#find(cmd) {|Command| ... } ⇒ Object

Find command

Yields:

  • (Command)

    This yields the found command

Raises:



77
78
79
80
81
82
83
84
# File 'lib/aruba/command_monitor.rb', line 77

def find(cmd)
  cmd = cmd.commandline if cmd.respond_to? :commandline
  command = registered_commands.reverse.find { |c| c.commandline == cmd }

  raise CommandNotFoundError, "No command named '#{cmd}' has been started" if command.nil?

  command
end