lib/mlist/list.rb in aiwilliams-mlist-0.1.1 vs lib/mlist/list.rb in aiwilliams-mlist-0.1.2
- old
+ new
@@ -5,11 +5,12 @@
# in processing email coming to a list - that is, whatever you include this
# into may re-define behavior appropriately.
#
module List
- # Answers whether this list is active or not.
+ # Answers whether this list is active or not. All lists are active all the
+ # time by default.
#
def active?
true
end
@@ -39,11 +40,22 @@
def post_url
address
end
+ # A list is responsible for answering the recipient subscribers.
+
+ # The subscriber of the incoming message is provided if the list would
+ # like to exclude it from the returned list. It is not assumed that it
+ # will be included or excluded, thereby allowing the list to decide. This
+ # default implementation does not include the sending subscriber in the
+ # list of recipients.
+ #
+ # Your 'subscriber' instance MUST respond to :email_address. They may
+ # optionally respond to :display_name.
+ #
def recipients(subscriber)
- subscribers.collect(&:email_address) - [subscriber.email_address]
+ subscribers.reject {|s| s.email_address == subscriber.email_address}
end
def subscriber(email_address)
subscribers.detect {|s| s.email_address == email_address}
end
\ No newline at end of file