Class: Tagomatic::UrlRemover

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

Constant Summary collapse

URL_REGEXP =
Regexp.compile("www\.[^\.]+\.[a-z]{2,4}", Regexp::IGNORECASE)

Instance Method Summary collapse

Instance Method Details

#process(tags_hash) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/tagomatic/url_remover.rb', line 5

def process(tags_hash)
  result = {}
  tags_hash.each do |tag,value|
    next unless value
    result[tag] = value.gsub(URL_REGEXP, '').gsub(/ by [a-zA-Z0-9]+[\w ]/, '')
  end
  result
end