From e54e5ee931b3991cbb5e427e7e5d27b3f6c75e6e Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Thu, 31 Jul 2014 19:35:40 -0300 Subject: Add fake-service --- fake-service/lib/smail/search/or_match.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 fake-service/lib/smail/search/or_match.rb (limited to 'fake-service/lib/smail/search/or_match.rb') diff --git a/fake-service/lib/smail/search/or_match.rb b/fake-service/lib/smail/search/or_match.rb new file mode 100644 index 00000000..455923bf --- /dev/null +++ b/fake-service/lib/smail/search/or_match.rb @@ -0,0 +1,25 @@ +module Smail + class Search + class OrMatch + attr_reader :left, :right + def initialize(left, right) + @left = left + @right = right + end + def <<(node) + @right << node + end + def to_s + "Or(#@left, #@right)" + end + + def match?(mail) + [@left, @right].any? { |mm| mm.match?(mail) } + end + + def match_string?(str) + [@left, @right].any? { |mm| mm.match_string?(str) } + end + end + end +end -- cgit v1.2.3