Class: TheArrayComparator::SearchingStrategies::Base

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

Overview

base class for strategies

Instance Method Summary collapse

Constructor Details

#initialize(sample = Sample.new) ⇒ Object

Create a new instance of strategy

Parameters:

  • sample (Sample) (defaults to: Sample.new)

    the probe which should be used for the check



17
18
19
20
21
22
# File 'lib/the_array_comparator/searching_strategies/base.rb', line 17

def initialize(sample=Sample.new)
  @data = sample.data
  @keywords = sample.keywords
  @exceptions = sample.exceptions
  @tag = sample.tag
end

Instance Method Details

#success?Boolean

Note:

needs to be implemented by the concrete strategy

Check the keywords with the data

Returns:

  • (Boolean)

Raises:

  • (RuntimeError)

    error when not implemented by strategy



30
31
32
# File 'lib/the_array_comparator/searching_strategies/base.rb', line 30

def success?
  raise Exceptions::IncompatibleComparator, "The chosen comparator is incompatible, Please check the documentation for comparator strategies on how to build a compatible one."
end