diff options
Diffstat (limited to 'fake-service/lib/smail/search/and_match.rb')
-rw-r--r-- | fake-service/lib/smail/search/and_match.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fake-service/lib/smail/search/and_match.rb b/fake-service/lib/smail/search/and_match.rb new file mode 100644 index 00000000..2bc53f0d --- /dev/null +++ b/fake-service/lib/smail/search/and_match.rb @@ -0,0 +1,25 @@ +module Smail + class Search + class AndMatch + attr_reader :data + def initialize(data = []) + @data = data + end + def <<(node) + @data << node + end + + def to_s + "And(#{@data.join(", ")})" + end + + def match?(mail) + self.data.all? { |mm| mm.match?(mail) } + end + + def match_string?(str) + self.data.all? { |mm| mm.match_string?(str) } + end + end + end +end |