Module: Fuelcell::Action::Subcommands
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add(cmds) ⇒ Object (also: #<<)
- #exist?(name) ⇒ Boolean
-
#global_options(target) ⇒ Hash
Collect global options from the option manager of every command in the Hierarchy.
-
#search(names) ⇒ Fuelcell::Command
Finds a subcommand by name.
Instance Method Details
#[](name) ⇒ Object
13 14 15 16 |
# File 'lib/fuelcell/action/subcommands.rb', line 13 def [](name) list = name.split(' ') deep_find(self, list) end |
#add(cmds) ⇒ Object Also known as: <<
7 8 9 10 |
# File 'lib/fuelcell/action/subcommands.rb', line 7 def add(cmds) cmds = [cmds] unless cmds.is_a?(Array) cmds.each { |cmd| subcommands[cmd.name] = cmd } end |
#exist?(name) ⇒ Boolean
18 19 20 21 22 |
# File 'lib/fuelcell/action/subcommands.rb', line 18 def exist?(name) list = name.split(' ') result = deep_find(self, list) result.is_a?(NotFound) ? false : true end |
#global_options(target) ⇒ Hash
Collect global options from the option manager of every command in the Hierarchy
36 37 38 |
# File 'lib/fuelcell/action/subcommands.rb', line 36 def (target) (target, self, {}) end |
#search(names) ⇒ Fuelcell::Command
Finds a subcommand by name.
28 29 30 |
# File 'lib/fuelcell/action/subcommands.rb', line 28 def search(names) deep_find(self, names) end |