Class: Dry::CLI::CommandRegistry::Chain Private
- Inherits:
-
Object
- Object
- Dry::CLI::CommandRegistry::Chain
- Defined in:
- lib/dry/cli/command_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.
Callbacks chain
Instance Attribute Summary collapse
- #chain ⇒ Object readonly private
Instance Method Summary collapse
- #append(&callback) ⇒ Object private
-
#initialize ⇒ Chain
constructor
private
A new instance of Chain.
- #run(context, *args) ⇒ Object private
Constructor Details
#initialize ⇒ Chain
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 Chain.
233 234 235 |
# File 'lib/dry/cli/command_registry.rb', line 233 def initialize @chain = Set.new end |
Instance Attribute Details
#chain ⇒ Object (readonly)
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.
229 230 231 |
# File 'lib/dry/cli/command_registry.rb', line 229 def chain @chain end |
Instance Method Details
#append(&callback) ⇒ 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.
239 240 241 |
# File 'lib/dry/cli/command_registry.rb', line 239 def append(&callback) chain.add(callback) end |
#run(context, *args) ⇒ 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.
245 246 247 248 249 |
# File 'lib/dry/cli/command_registry.rb', line 245 def run(context, *args) chain.each do |callback| context.instance_exec(*args, &callback) end end |