Permalink
Browse files

don't fail if the to, from, or cc being matched against isn't an array

  • Loading branch information...
Brian Pokosh
Brian Pokosh committed Feb 9, 2012
1 parent cf43e6f commit 1cf145c99266f34b17417a44d2ad1c710895927b
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/mailman/route/conditions.rb
@@ -5,7 +5,7 @@ class Route
class ToCondition < Condition
def match(message)
if !message.to.nil?
- message.to.each do |address|
+ (message.to.is_a?(Array) ? message.to : [message.to]).each do |address|
if result = @matcher.match(address)
return result
end
@@ -18,7 +18,7 @@ def match(message)
# Matches against the From addresses of a message.
class FromCondition < Condition
def match(message)
- message.from.each do |address|
+ (message.from.is_a?(Array) ? message.from : [message.from]).each do |address|
if result = @matcher.match(address)
return result
end
@@ -53,7 +53,7 @@ def match(message)
class CcCondition < Condition
def match(message)
if !message.cc.nil?
- message.cc.each do |address|
+ (message.cc.is_a?(Array) ? message.cc : [message.cc]).each do |address|
if result = @matcher.match(address)
return result
end

0 comments on commit 1cf145c

Please sign in to comment.