Module: Pedantic::Unimportant

Included in:
Pedantic
Defined in:
lib/pedantic/unimportant.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
# File 'lib/pedantic/unimportant.rb', line 2

def self.included(base)
  base.processors :remove_unimportant_words
end

Instance Method Details

#remove_unimportant_words(string) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pedantic/unimportant.rb', line 6

def remove_unimportant_words(string)
  %w(
    a again all along also an and are as at but by came can cant couldnt did 
    didn didnt do doesnt dont ever first from have her here him how i if in 
    into is isnt it itll just last least like most my new no not now of on or
    should sinc so some th than this that the their then those to told too
    true try until url us were when whether while with within yes you youll
  ).each { |word|
    string.gsub!(/\b#{word}\b/, '')
  }
  
  string
end