Module: PubsubNotifier::ActsAsNotifier::ClassMethods

Defined in:
lib/pubsub_notifier/acts_as_notifier.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_notifierObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pubsub_notifier/acts_as_notifier.rb', line 10

def acts_as_notifier
  class_eval do
    class << self
      private

        def method_missing(method_name, *args)
          if action_methods.include?(method_name.to_s)
            ::ActionMailer::MessageDelivery.new(self, method_name, *args).tap(&:deliver)
          else
            super
          end
        end

        def respond_to_missing?(method_name, include_all = false)
          action_methods.include?(method_name.to_s) || super
        end
    end
  end
end