Class: ActivityNotification::OptionalTarget::Base
- Inherits:
-
Object
- Object
- ActivityNotification::OptionalTarget::Base
- Defined in:
- lib/activity_notification/optional_targets/base.rb
Overview
Abstract optional target class to develop optional notification target class.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
Initialize method to create view context in this OptionalTarget instance.
-
#initialize_target(_options = {}) ⇒ Object
Initialize method to be overridden in user implementation class.
-
#notify(_notification, _options = {}) ⇒ Object
Publishing notification method to be overridden in user implementation class.
-
#to_optional_target_name ⇒ Object
Returns demodulized symbol class name as optional target name.
Constructor Details
#initialize(options = {}) ⇒ Base
Initialize method to create view context in this OptionalTarget instance
10 11 12 |
# File 'lib/activity_notification/optional_targets/base.rb', line 10 def initialize( = {}) initialize_target() unless .delete(:skip_initializing_target) end |
Instance Method Details
#initialize_target(_options = {}) ⇒ Object
Initialize method to be overridden in user implementation class
22 23 24 |
# File 'lib/activity_notification/optional_targets/base.rb', line 22 def initialize_target( = {}) raise NotImplementedError, "You have to implement #{self.class}##{__method__}" end |
#notify(_notification, _options = {}) ⇒ Object
Publishing notification method to be overridden in user implementation class
29 30 31 |
# File 'lib/activity_notification/optional_targets/base.rb', line 29 def notify(_notification, = {}) raise NotImplementedError, "You have to implement #{self.class}##{__method__}" end |
#to_optional_target_name ⇒ Object
Returns demodulized symbol class name as optional target name
16 17 18 |
# File 'lib/activity_notification/optional_targets/base.rb', line 16 def to_optional_target_name self.class.name.demodulize.underscore.to_sym end |