Class: Hanami::Utils::Callbacks::Callback Private
- Inherits:
-
Object
- Object
- Hanami::Utils::Callbacks::Callback
- Defined in:
- lib/idempotency/hanami/utils/callbacks.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.
Proc callback It wraps an object that responds to #call
Direct Known Subclasses
Instance Attribute Summary collapse
- #callback ⇒ Object readonly private
Instance Method Summary collapse
-
#call(context, *args) ⇒ void, Object
private
Executes the callback within the given context and passing the given arguments.
-
#initialize(callback) ⇒ Callback
constructor
private
Initialize by wrapping the given callback.
Constructor Details
#initialize(callback) ⇒ Callback
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.
Initialize by wrapping the given callback
238 239 240 |
# File 'lib/idempotency/hanami/utils/callbacks.rb', line 238 def initialize(callback) @callback = callback end |
Instance Attribute Details
#callback ⇒ 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.
228 229 230 |
# File 'lib/idempotency/hanami/utils/callbacks.rb', line 228 def callback @callback end |
Instance Method Details
#call(context, *args) ⇒ void, 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.
Executes the callback within the given context and passing the given arguments.
253 254 255 |
# File 'lib/idempotency/hanami/utils/callbacks.rb', line 253 def call(context, *args) context.instance_exec(*args, &callback) end |