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.
246 247 248 |
# File 'lib/dry/cli/command_registry.rb', line 246 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.
242 243 244 |
# File 'lib/dry/cli/command_registry.rb', line 242 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.
252 253 254 |
# File 'lib/dry/cli/command_registry.rb', line 252 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.
258 259 260 261 262 |
# File 'lib/dry/cli/command_registry.rb', line 258 def run(context, *args) chain.each do |callback| context.instance_exec(*args, &callback) end end |