Class: Untied::Publisher::Observer
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveRecord::Observer
- Untied::Publisher::Observer
- Defined in:
- lib/untied-publisher/observer.rb
Instance Method Summary collapse
-
#initialize ⇒ Observer
constructor
A new instance of Observer.
- #method_missing(name, model, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Observer
Returns a new instance of Observer.
9 10 11 12 13 14 15 16 17 |
# File 'lib/untied-publisher/observer.rb', line 9 def initialize Publisher.config.logger.info "Untied: Initializing publisher observer" publisher.define_callbacks observed = publisher.observed_classes self.class.send(:define_method, :observed_classes, Proc.new { observed }) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, model, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/untied-publisher/observer.rb', line 19 def method_missing(name, model, *args, &block) if ActiveRecord::Callbacks::CALLBACKS.include?(name) = args.first.is_a?(Hash) ? args.first : {} produce_event(name, model, ) else super end end |