Method: NgWord::Rule#initialize

Defined in:
lib/ng_word/rule.rb

#initialize(ng_word, exclude_words: []) ⇒ Rule

Returns a new instance of Rule.



5
6
7
8
9
10
11
12
13
# File 'lib/ng_word/rule.rb', line 5

def initialize(ng_word, exclude_words: [])
  @ng_word = ng_word
  @exclude_words = exclude_words

  @downcased_ng_word = @ng_word.downcase
  @exclude_word_rules = Array(@exclude_words).map { |w| ExcludeWordRule.new(@downcased_ng_word, w) }

  freeze
end