Class: Roby::Interface::SubcommandClient
- Defined in:
- lib/roby/interface/subcommand_client.rb
Overview
Representation of a subcommand on Interface on the shell side
Direct Known Subclasses
Instance Attribute Summary collapse
-
#commands ⇒ String
readonly
The set of commands on this subcommand.
-
#description ⇒ String
readonly
The subcommand description.
- #name ⇒ Object readonly
-
#parent ⇒ ShellClient, ShellSubcommand
readonly
The parent shell / subcommand.
Instance Method Summary collapse
- #call(path, m, *args) ⇒ Object
-
#initialize(parent, name, description, commands) ⇒ SubcommandClient
constructor
A new instance of SubcommandClient.
- #method_missing(m, *args) ⇒ Object
- #path ⇒ Object
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
#commands ⇒ String (readonly)
Returns the set of commands on this subcommand.
14 15 16 |
# File 'lib/roby/interface/subcommand_client.rb', line 14 def commands @commands end |
#description ⇒ String (readonly)
Returns the subcommand description.
12 13 14 |
# File 'lib/roby/interface/subcommand_client.rb', line 12 def description @description end |
#name ⇒ Object (readonly)
10 11 12 |
# File 'lib/roby/interface/subcommand_client.rb', line 10 def name @name end |
#parent ⇒ ShellClient, ShellSubcommand (readonly)
Returns the parent shell / subcommand.
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 |
#path ⇒ Object
25 26 27 |
# File 'lib/roby/interface/subcommand_client.rb', line 25 def path parent.path + [name] end |