Class: TheArrayComparator::SearchingStrategies::ContainsAny

Inherits:
Base
  • Object
show all
Defined in:
lib/the_array_comparator/searching_strategies/contains_any.rb

Overview

strategy contains

Instance Method Summary collapse

Constructor Details

#initialize(sample = Sample.new) ⇒ ContainsAny

Create a new instance of strategy

See Also:



13
14
15
16
17
# File 'lib/the_array_comparator/searching_strategies/contains_any.rb', line 13

def initialize(sample=Sample.new)
  super

  warning_unsupported_exceptions
end

Instance Method Details

#success?Boolean

Check the keywords with the data

Returns:

  • (Boolean)

    The result of the check



23
24
25
26
27
28
29
30
31
# File 'lib/the_array_comparator/searching_strategies/contains_any.rb', line 23

def success?
  return true if @keywords.blank? and @data.blank?

  if ( @keywords & @data ).blank?
    return false
  else
    return true
  end
end