Module: TheHelp::ProvidesCallbacks
- Included in:
- Service
- Defined in:
- lib/the_help/provides_callbacks.rb
Overview
Adds a callback DSL to including classes
If the including class defines a #logger instance method, a debug-level message will be logged indicating that the callback was invoked.
Defined Under Namespace
Modules: ClassMethods Classes: CallbackNotDefinedError
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(other) ⇒ Object
43 44 45 46 47 |
# File 'lib/the_help/provides_callbacks.rb', line 43 def self.included(other) other.class_eval do extend TheHelp::ProvidesCallbacks::ClassMethods end end |
Instance Method Details
#callback(callback_name) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/the_help/provides_callbacks.rb', line 49 def callback(callback_name) return method(callback_name) if _provides_callbacks_callback_defined?( callback_name ) raise CallbackNotDefinedError, "The callback :#{callback_name} has not been defined." end |