Class: ProfanityFilterEngine::PartialMatchStrategy

Inherits:
RegexpStrategy show all
Defined in:
lib/profanity-filter/engines/partial_match_strategy.rb

Constant Summary collapse

DEFAULT_IGNORE_CASE =
false

Constants inherited from RegexpStrategy

RegexpStrategy::DEFAULT_DELIMITER

Instance Attribute Summary collapse

Attributes inherited from RegexpStrategy

#dictionary, #profanity_regexp

Instance Method Summary collapse

Methods inherited from RegexpStrategy

#profane?, #profane_words

Methods inherited from Component

#profane?, #profane_words, #profanity_count

Constructor Details

#initialize(dictionary:, ignore_case: DEFAULT_IGNORE_CASE) ⇒ PartialMatchStrategy

Returns a new instance of PartialMatchStrategy.



11
12
13
14
15
# File 'lib/profanity-filter/engines/partial_match_strategy.rb', line 11

def initialize(dictionary:, ignore_case: DEFAULT_IGNORE_CASE)
  @dictionary = dictionary
  @ignore_case = ignore_case
  @profanity_regexp = build_profanity_regexp
end

Instance Attribute Details

#ignore_caseObject (readonly)

Returns the value of attribute ignore_case.



9
10
11
# File 'lib/profanity-filter/engines/partial_match_strategy.rb', line 9

def ignore_case
  @ignore_case
end