Class: EasyCallbacks::Models::TargetClass
- Inherits:
-
Object
- Object
- EasyCallbacks::Models::TargetClass
- Defined in:
- lib/easy_callbacks/models/target_class.rb
Instance Attribute Summary collapse
-
#callbacks_repository ⇒ Object
Returns the value of attribute callbacks_repository.
-
#target_class ⇒ Object
readonly
Returns the value of attribute target_class.
Instance Method Summary collapse
- #add_callback(callback_type, target_method_name, callback_method_name, &callback_block) ⇒ Object
- #get_callbacks_for(callback_type, target_method_name) ⇒ Object
-
#initialize(target_class) ⇒ TargetClass
constructor
A new instance of TargetClass.
Constructor Details
#initialize(target_class) ⇒ TargetClass
Returns a new instance of TargetClass.
8 9 10 11 |
# File 'lib/easy_callbacks/models/target_class.rb', line 8 def initialize(target_class) self.target_class = target_class self.callbacks_repository = ::EasyCallbacks::Repositories::CallbacksRepository.new self end |
Instance Attribute Details
#callbacks_repository ⇒ Object
Returns the value of attribute callbacks_repository.
6 7 8 |
# File 'lib/easy_callbacks/models/target_class.rb', line 6 def callbacks_repository @callbacks_repository end |
#target_class ⇒ Object
Returns the value of attribute target_class.
6 7 8 |
# File 'lib/easy_callbacks/models/target_class.rb', line 6 def target_class @target_class end |
Instance Method Details
#add_callback(callback_type, target_method_name, callback_method_name, &callback_block) ⇒ Object
13 14 15 |
# File 'lib/easy_callbacks/models/target_class.rb', line 13 def add_callback(callback_type, target_method_name, callback_method_name, &callback_block) callbacks_repository.find_or_add callback_type, target_method_name, callback_method_name, &callback_block end |
#get_callbacks_for(callback_type, target_method_name) ⇒ Object
17 18 19 |
# File 'lib/easy_callbacks/models/target_class.rb', line 17 def get_callbacks_for(callback_type, target_method_name) callbacks_repository.get_callbacks_for callback_type, target_method_name end |