Class: MiniSearch::StopWordsFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_search/stop_words_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(stop_words) ⇒ StopWordsFilter

Returns a new instance of StopWordsFilter.



5
6
7
# File 'lib/mini_search/stop_words_filter.rb', line 5

def initialize(stop_words)
  @stop_words = stop_words
end

Instance Method Details

#execute(tokens) ⇒ Object



9
10
11
# File 'lib/mini_search/stop_words_filter.rb', line 9

def execute(tokens)
  tokens.reject { |token| @stop_words.include?(token) }
end