class String

Public Instance Methods

add_nofollow() click to toggle source
# File lib/rel_nofollow/string.rb, line 2
def add_nofollow
  self.gsub(/<a [^>]+>/) do |link|
    unless link.include?('rel="nofollow"')
      link = link[0..-2] + ' rel="nofollow">'
    end
    link
  end
end