diff options
Diffstat (limited to 'fake-service/lib/pixelated_service/search/string_match.rb')
-rw-r--r-- | fake-service/lib/pixelated_service/search/string_match.rb | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/fake-service/lib/pixelated_service/search/string_match.rb b/fake-service/lib/pixelated_service/search/string_match.rb deleted file mode 100644 index f9b32376..00000000 --- a/fake-service/lib/pixelated_service/search/string_match.rb +++ /dev/null @@ -1,37 +0,0 @@ -module PixelatedService - class Search - class StringMatch - attr_reader :str - def initialize(data, quoted=false) - @str = data - @quoted = quoted - @data = Regexp.new(Regexp.quote(self.match_string), Regexp::IGNORECASE) - @exact_match = /^#{@data}$/ - end - - def match_string - if @quoted - @str[1..-2] - else - @str - end - end - - def to_s - "String(#@data)" - end - - def match_string?(str) - Array(str).any? { |ff| !!(ff[@data]) } - end - - def match_exact_string?(str) - Array(str).any? { |ff| @exact_match.match ff } - end - - def match?(mail) - match_string? [mail.to, mail.from, mail.subject, mail.body] - end - end - end -end |