Class: Roby::Interface::SubcommandClient

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/interface/subcommand_client.rb

Overview

Representation of a subcommand on Interface on the shell side

Direct Known Subclasses

ShellSubcommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, name, description, commands) ⇒ SubcommandClient

Returns a new instance of SubcommandClient.



16
17
18
19
# File 'lib/roby/interface/subcommand_client.rb', line 16

def initialize(parent, name, description, commands)
    @parent, @name, @description, @commands =
        parent, name, description, commands
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



29
30
31
# File 'lib/roby/interface/subcommand_client.rb', line 29

def method_missing(m, *args)
    parent.call([name], m, *args)
end

Instance Attribute Details

#commandsString (readonly)

Returns the set of commands on this subcommand.

Returns:

  • (String)

    the set of commands on this subcommand



14
15
16
# File 'lib/roby/interface/subcommand_client.rb', line 14

def commands
  @commands
end

#descriptionString (readonly)

Returns the subcommand description.

Returns:

  • (String)

    the subcommand description



12
13
14
# File 'lib/roby/interface/subcommand_client.rb', line 12

def description
  @description
end

#nameObject (readonly)

Returns:

  • [

  • (String)

    the subcommand name



10
11
12
# File 'lib/roby/interface/subcommand_client.rb', line 10

def name
  @name
end

#parentShellClient, ShellSubcommand (readonly)

Returns the parent shell / subcommand.

Returns:



7
8
9
# File 'lib/roby/interface/subcommand_client.rb', line 7

def parent
  @parent
end

Instance Method Details

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



21
22
23
# File 'lib/roby/interface/subcommand_client.rb', line 21

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

#pathObject



25
26
27
# File 'lib/roby/interface/subcommand_client.rb', line 25

def path
    parent.path + [name]
end