Class: Mooncell::CLI::Commands::Registry Private
- Inherits:
-
Object
- Object
- Mooncell::CLI::Commands::Registry
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/mooncell/cli/commands/registry.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Command Registry
Defined Under Namespace
Classes: Node
Instance Method Summary collapse
- #add(name, command = nil, aliases: [], app_only: false, &block) ⇒ Object private
- #get(arguments) ⇒ Object private
-
#initialize ⇒ Registry
constructor
private
A new instance of Registry.
Constructor Details
#initialize ⇒ Registry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Registry.
24 25 26 |
# File 'lib/mooncell/cli/commands/registry.rb', line 24 def initialize @root = Node.new end |
Instance Method Details
#add(name, command = nil, aliases: [], app_only: false, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/mooncell/cli/commands/registry.rb', line 30 def add(name, command = nil, aliases: [], app_only: false, &block) @root.add(name, command, aliases: aliases, app_only: app_only, &block) end |
#get(arguments) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mooncell/cli/commands/registry.rb', line 36 def get(arguments) node = @root arguments.each do |token| current = node.lookup(token) return node if current.nil? && node.leaf? node = current end node end |