Class: Vigilem::Core::Hooks::MetaCallback
- Inherits:
-
CallbackProc
- Object
- Proc
- CallbackProc
- Vigilem::Core::Hooks::MetaCallback
- Defined in:
- lib/vigilem/core/hooks/meta_callback.rb
Overview
TODO:
better name?
CallbackProc that remebers if it has been ran/evaluated/called
Instance Attribute Summary
Attributes included from Callback
Instance Method Summary collapse
-
#call(*args, &block) ⇒ Object
The result of the proc.
-
#evaluate(context, *args, &block) ⇒ Object
(also: #[])
The result of the.
-
#initialize(cbp = nil, &block) ⇒ MetaCallback
constructor
A new instance of MetaCallback.
-
#ran? ⇒ TrueClass || FalseClass
whether or not this proc ran.
Methods inherited from CallbackProc
Methods included from Callback
Constructor Details
#initialize(cbp = nil, &block) ⇒ MetaCallback
Returns a new instance of MetaCallback.
12 13 14 15 |
# File 'lib/vigilem/core/hooks/meta_callback.rb', line 12 def initialize(cbp=nil, &block) self.ran = false super(cbp || CallbackProc.new(&block)) end |
Instance Method Details
#call(*args, &block) ⇒ Object
Returns the result of the proc.
33 34 35 36 |
# File 'lib/vigilem/core/hooks/meta_callback.rb', line 33 def call(*args, &block) self.ran = true super(*args, &block) end |
#evaluate(context, *args, &block) ⇒ Object Also known as: []
Returns the result of the.
22 23 24 25 |
# File 'lib/vigilem/core/hooks/meta_callback.rb', line 22 def evaluate(context, *args, &block) self.ran = true super(context, *args, &block) end |
#ran? ⇒ TrueClass || FalseClass
whether or not this proc ran
40 41 42 |
# File 'lib/vigilem/core/hooks/meta_callback.rb', line 40 def ran? @ran end |