summaryrefslogtreecommitdiff
path: root/fake-service/lib/pixelated_service/search/and_match.rb
diff options
context:
space:
mode:
Diffstat (limited to 'fake-service/lib/pixelated_service/search/and_match.rb')
-rw-r--r--fake-service/lib/pixelated_service/search/and_match.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/fake-service/lib/pixelated_service/search/and_match.rb b/fake-service/lib/pixelated_service/search/and_match.rb
new file mode 100644
index 00000000..dfd0f287
--- /dev/null
+++ b/fake-service/lib/pixelated_service/search/and_match.rb
@@ -0,0 +1,25 @@
+module PixelatedService
+ 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