Permalink
Browse files

Fixing observer support so any observer can only be added once

  • Loading branch information...
1 parent f0e558f commit b9144e1ec4cf41f0e105ea614bc17bb2164588b1 @mikel mikel committed Jan 24, 2010
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/mail/message.rb
View
@@ -122,7 +122,9 @@ def initialize(*args, &block)
attr_accessor :raise_delivery_errors
def register_for_delivery_notification(observer)
- @delivery_notification_observers << observer
+ unless @delivery_notification_observers.include?(observer)
+ @delivery_notification_observers << observer
+ end
end
def inform_observers
@@ -147,6 +149,7 @@ def deliver
end
end
inform_observers
+ self
end
alias :deliver! :deliver

0 comments on commit b9144e1

Please sign in to comment.