Class: SensitiveWordFilter::Filter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_paths = []) ⇒ Filter

Returns a new instance of 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_pathsObject (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