Sha256: b3d8199c63a1a4278b10053a0d1edeb6c52c5c558a97250d1d03dff690e1d47a

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

#encoding: utf-8

# the main module
module TheArrayComparator
  # the available strategies
  module Strategies
    # strategy contains substring
    class ContainsAnyWithSubstringSearch < Base

      # Create a new instance of strategy
      #
      # @see Base
      def initialize(sample=Sample.new)
        super
      end

      # Check the keywords with the data
      #
      # @return [Boolean]
      #   The result of the check
      def success?
        return true if @keywords.blank? and @data.blank?

        return true if @data.any? do |line| 
          #does a keyword match and it is not an the exception list
          @keywords.any?{ |k| line[k] } and not @exceptions.any?{ |e| line[e] }
        end

        false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
the_array_comparator-0.2.0 lib/the_array_comparator/strategies/contains_any_with_substring_search.rb
the_array_comparator-0.1.1 lib/the_array_comparator/strategies/contains_any_with_substring_search.rb