module Utility::URL

Public Instance Methods

html_escape(html) click to toggle source
# File lib/utility/url.rb, line 26
def html_escape(html)
  CGI::escapeHTML(html).gsub(" ", " ")
end
html_text(html) click to toggle source
# File lib/utility/url.rb, line 34
def html_text(html)
  Nokogiri::HTML(html).text
end
html_unescape(html) click to toggle source
# File lib/utility/url.rb, line 30
def html_unescape(html)
  Nokogiri::HTML.parse(html).text
end
parse_query(url) click to toggle source
# File lib/utility/url.rb, line 6
def parse_query(url)
  if url =~ URI::regexp
    CGI.parse URI.parse(url).query
  else
    CGI.parse url
  end
end
url_escape(url, all = :no) click to toggle source
# File lib/utility/url.rb, line 14
def url_escape(url, all = :no)
  if url =~ URI::regexp && all != :all
    URI.escape url
  else
    CGI::escape url
  end
end
url_unescape(url) click to toggle source
# File lib/utility/url.rb, line 22
def url_unescape(url)
  URI.unescape url
end