Module: Hanami::CLI::Registry
- Defined in:
- lib/hanami/cli/registry.rb
Overview
Registry mixin
Defined Under Namespace
Classes: Prefix
Class Method Summary collapse
- .extended(base) ⇒ Object private
Instance Method Summary collapse
- #get(arguments) ⇒ Object private
-
#register(name, command = nil, aliases: [], **options) ⇒ Object
Register a command.
Class Method Details
.extended(base) ⇒ 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.
11 12 13 14 15 |
# File 'lib/hanami/cli/registry.rb', line 11 def self.extended(base) base.class_eval do @commands = CommandRegistry.new end end |
Instance Method Details
#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.
85 86 87 |
# File 'lib/hanami/cli/registry.rb', line 85 def get(arguments) @commands.get(arguments) end |
#register(name, command = nil, aliases: [], **options) ⇒ Object
Register a command
75 76 77 78 79 80 81 |
# File 'lib/hanami/cli/registry.rb', line 75 def register(name, command = nil, aliases: [], **) if block_given? yield Prefix.new(@commands, name, aliases) else @commands.set(name, command, aliases, **) end end |