Class: Dry::Transaction::StepAdapter Private
- Inherits:
-
Object
- Object
- Dry::Transaction::StepAdapter
- Defined in:
- lib/dry/transaction/step_adapter.rb
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.
Instance Attribute Summary collapse
- #adapter ⇒ Object readonly private
- #operation ⇒ Object readonly private
- #options ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #call(args, &block) ⇒ Object private
-
#initialize(adapter, operation, options) ⇒ StepAdapter
constructor
private
A new instance of StepAdapter.
- #with(operation = self.operation, new_options = {}) ⇒ Object private
- #yields? ⇒ Boolean private
Constructor Details
#initialize(adapter, operation, options) ⇒ StepAdapter
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 StepAdapter.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dry/transaction/step_adapter.rb', line 21 def initialize(adapter, operation, ) @adapter = case adapter when Proc, Method adapter else adapter.method(:call) end @operation = Callable[operation] @options = @yields = @adapter .parameters .any? { |type, _| type == :block } end |
Instance Attribute Details
#adapter ⇒ 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.
17 18 19 |
# File 'lib/dry/transaction/step_adapter.rb', line 17 def adapter @adapter end |
#operation ⇒ 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.
18 19 20 |
# File 'lib/dry/transaction/step_adapter.rb', line 18 def operation @operation end |
#options ⇒ 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.
19 20 21 |
# File 'lib/dry/transaction/step_adapter.rb', line 19 def @options end |
Class Method Details
.[](adapter, operation, options) ⇒ 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.
9 10 11 12 13 14 15 |
# File 'lib/dry/transaction/step_adapter.rb', line 9 def self.[](adapter, operation, ) if adapter.is_a?(self) adapter.with(operation, ) else new(adapter, operation, ) end end |
Instance Method Details
#call(args, &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.
42 43 44 |
# File 'lib/dry/transaction/step_adapter.rb', line 42 def call(args, &block) adapter.(operation, , args, &block) end |
#with(operation = self.operation, new_options = {}) ⇒ 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.
46 47 48 |
# File 'lib/dry/transaction/step_adapter.rb', line 46 def with(operation = self.operation, = {}) self.class.new(adapter, operation, .merge()) end |
#yields? ⇒ Boolean
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.
38 39 40 |
# File 'lib/dry/transaction/step_adapter.rb', line 38 def yields? @yields end |