Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Extensions #:nodoc:
- module CoreExtensions #:nodoc:
- module StringExtensions #:nodoc:
- def convert_relative_to_absolute(domain)
- regexes = [/href="(.*?)"/mis,/src="(.*?)"/mis]
- this = self
- regexes.each do |search|
- results = search.match(this)
- results.captures.each{|found| this = this.gsub(found,"#{domain}#{found}") } if results && results.captures
- end
- return this
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment