Sha256: ec047975b18e6335b6b455d7da7c0b1fd1b209b9fb86167d8754d0ca36b92040

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

#encoding: utf-8

# the main module
module TheArrayComparator
  # the available strategies
  module Strategies
    # strategy not contains substring
    class ContainsNotWithSubstringSearch < 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 false if @keywords.blank? and @data.blank?

        return true if @data.all? do |line| 
          #if a keyword is found, check if there's an exception
          @keywords.none?{ |k| line[k] } or @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_not_with_substring_search.rb
the_array_comparator-0.1.1 lib/the_array_comparator/strategies/contains_not_with_substring_search.rb