Class: DespamilatorFilter::SquareBrackets

Inherits:
Despamilator::Filter show all
Defined in:
lib/despamilator/filter/square_brackets.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



11
12
13
# File 'lib/despamilator/filter/square_brackets.rb', line 11

def description
  'Detects each square bracket in a string'
end

#nameObject



7
8
9
# File 'lib/despamilator/filter/square_brackets.rb', line 7

def name
  'Square Brackets'
end

#parse(subject) ⇒ Object



15
16
17
18
19
# File 'lib/despamilator/filter/square_brackets.rb', line 15

def parse subject
  subject.text.downcase.scan(/(\[|\])/).each do |match|
    subject.register_match!({:score => 0.05, :filter => self})
  end
end