Class: Roby::Interface::V2::ShellSubcommand

Inherits:
SubcommandClient show all
Defined in:
lib/roby/interface/v2/shell_subcommand.rb

Overview

Representation of a subcommand on Interface on the shell side

Instance Attribute Summary

Attributes inherited from SubcommandClient

#commands, #description, #name, #parent

Instance Method Summary collapse

Methods inherited from SubcommandClient

#async_call, #find_subcommand_by_name, #has_command?, #initialize, #path

Constructor Details

This class inherits a constructor from Roby::Interface::V2::SubcommandClient

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/roby/interface/v2/shell_subcommand.rb', line 12

def method_missing(m, *args)
    parent.call({}, [name], m, *args)
rescue NoMethodError => e
    if e.message =~ /undefined method .#{m}./
        puts "invalid command name #{m}, "\
             "call 'help #{path.join('.')}' for more information"
    else
        raise
    end
rescue ArgumentError => e
    if e.message =~ /wrong number of arguments/ &&
       e.backtrace.first =~ /#{m}/
        puts e.message
    else
        raise
    end
end

Instance Method Details

#call(options, path, m, *args) ⇒ Object



8
9
10
# File 'lib/roby/interface/v2/shell_subcommand.rb', line 8

def call(options, path, m, *args)
    parent.call(options, [name] + path, m, *args)
end