FooBar

Ruby code posted by dirtyhand
created at 05 Apr 20:59

Edit | Back
1
2
3
4
5
6
7
def to_link(member_id='default-member')
    # UGLY - change later
    doc = Hpricot(code)
    link = doc.search('a').first[:href]
    link = " href=\"#{link}#{retailer.broker.member_id_template}=#{member_id}\""
    code.gsub(/<(.*?)>/) {|innards| innards.gsub(/ href=("|').*?\1/, link) }
  end
299 Bytes in 5 ms with coderay