Module: Pedantic::Uris

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

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

Instance Method Details

#remove_uris(string) ⇒ Object



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

def remove_uris(string)
  [
    /https?:\/\/\S+/,
    /([\w\.])+\.(com|co|net|org|info)(\.\w+)?/
  ].each { |pattern|
    string.gsub!(pattern, '')
  }
  
  string
end