Class: SensitiveWordFilter::Filter
- Inherits:
-
Object
- Object
- SensitiveWordFilter::Filter
- Defined in:
- lib/sensitive_word_filter.rb
Instance Attribute Summary collapse
-
#file_paths ⇒ Object
readonly
Returns the value of attribute file_paths.
Instance Method Summary collapse
-
#initialize(file_paths = []) ⇒ Filter
constructor
A new instance of Filter.
- #scan(text = '') ⇒ Object
Constructor Details
#initialize(file_paths = []) ⇒ Filter
15 16 17 18 19 20 21 |
# File 'lib/sensitive_word_filter.rb', line 15 def initialize(file_paths=[]) if file_paths.empty? raise Error.new('sensitive words file path is empty') else @words = Load.new(file_paths).load end end |
Instance Attribute Details
#file_paths ⇒ Object (readonly)
Returns the value of attribute file_paths.
13 14 15 |
# File 'lib/sensitive_word_filter.rb', line 13 def file_paths @file_paths end |
Instance Method Details
#scan(text = '') ⇒ Object
23 24 25 |
# File 'lib/sensitive_word_filter.rb', line 23 def scan(text='') Scan.new(@words).scan(text) end |