Class: Jekyll::FastReader::StopWords

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/fast_reader/stop_words.rb

Constant Summary collapse

DEFAULT =
Set.new(%w[
  a an the of in on at to by or is as
  and but for nor so yet
  it its this that
]).freeze

Instance Method Summary collapse

Constructor Details

#initialize(extra = []) ⇒ StopWords

Returns a new instance of StopWords.



12
13
14
# File 'lib/jekyll/fast_reader/stop_words.rb', line 12

def initialize(extra = [])
  @words = DEFAULT | Set.new(extra.map(&:downcase))
end

Instance Method Details

#stop?(word) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/jekyll/fast_reader/stop_words.rb', line 16

def stop?(word)
  @words.include?(word.downcase)
end