Class: Hanami::Utils::Callbacks::MethodCallback Private
- Defined in:
- lib/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.
Method callback
It wraps a symbol or a string representing a method name that is implemented by the context within it will be called.
Instance Attribute Summary
Attributes inherited from Callback
Instance Method Summary collapse
-
#call(context, *args) ⇒ void, Object
private
Executes the callback within the given context and eventually passing the given arguments.
- #eql?(other) ⇒ Boolean private
- #hash ⇒ Object private
Methods inherited from Callback
Constructor Details
This class inherits a constructor from Hanami::Utils::Callbacks::Callback
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 eventually passing the given arguments. Those arguments will be passed according to the arity of the target method.
294 295 296 297 298 299 300 301 302 |
# File 'lib/hanami/utils/callbacks.rb', line 294 def call(context, *args) method = context.method(callback) if method.parameters.any? method.call(*args) else method.call end end |
#eql?(other) ⇒ 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.
310 311 312 |
# File 'lib/hanami/utils/callbacks.rb', line 310 def eql?(other) hash == other.hash end |
#hash ⇒ 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.
305 306 307 |
# File 'lib/hanami/utils/callbacks.rb', line 305 def hash callback.hash end |