Sha256: b2055832a69943e485225ae01fccd0019c852d2fd7a316f52f64c6e7df595114

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 Bytes

Contents

module Replyr
  module HandleBounce

    def self.included(base)
      base.extend ClassMethods  
    end
  
    module ClassMethods 
    
      # Usage:
      # class Comment < ActiveRecord::Base
      #   handle_bounce do |comment, email|
      #     # your custom code (e.g. mark email as invalid)
      #   end
      # end
      #
      def handle_bounce(*options, &block)	
    		options = options.extract_options!

        define_method :handle_bounce do |email|
          block.call(self, email) 
        end
  
        define_method :bounce_address_object do
          BounceAddress.new(self)
        end
        
        define_method :bounce_address do
          bounce_address_object.to_s
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
replyr-0.1.0 lib/replyr/handle_bounce.rb
replyr-0.0.9 lib/replyr/handle_bounce.rb
replyr-0.0.8 lib/replyr/handle_bounce.rb