module PubsubNotifier::ActsAsNotifier::ClassMethods

Private Class Methods

method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/pubsub_notifier/acts_as_notifier.rb, line 15
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
respond_to_missing?(method_name, include_all = false) click to toggle source
Calls superclass method
# File lib/pubsub_notifier/acts_as_notifier.rb, line 23
def respond_to_missing?(method_name, include_all = false)
  action_methods.include?(method_name.to_s) || super
end

Public Instance Methods

acts_as_notifier() click to toggle source

Override ActionMailer::Base.method_missing github.com/rails/rails/blob/master/actionmailer/lib/action_mailer/base.rb#L576

# 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