Class: TheArrayComparator::SearchingStrategies::ContainsAnyWithSubstringSearch
- Inherits:
-
Base
- Object
- Base
- TheArrayComparator::SearchingStrategies::ContainsAnyWithSubstringSearch
- Defined in:
- lib/the_array_comparator/searching_strategies/contains_any_with_substring_search.rb
Overview
strategy contains substring
Instance Method Summary collapse
-
#initialize(sample = Sample.new) ⇒ ContainsAnyWithSubstringSearch
constructor
Create a new instance of strategy.
-
#success? ⇒ Boolean
Check the keywords with the data.
Constructor Details
#initialize(sample = Sample.new) ⇒ ContainsAnyWithSubstringSearch
Create a new instance of strategy
13 14 15 |
# File 'lib/the_array_comparator/searching_strategies/contains_any_with_substring_search.rb', line 13 def initialize(sample=Sample.new) super end |
Instance Method Details
#success? ⇒ Boolean
Check the keywords with the data
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/the_array_comparator/searching_strategies/contains_any_with_substring_search.rb', line 21 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 |