| Class | WWW::Mechanize::Util |
| In: |
lib/www/mechanize/util.rb
|
| Parent: | Object |
# File lib/www/mechanize/util.rb, line 5
5: def build_query_string(parameters)
6: parameters.map { |k,v|
7: k &&
8: [WEBrick::HTTPUtils.escape_form(k.to_s),
9: WEBrick::HTTPUtils.escape_form(v.to_s)].join("=")
10: }.compact.join('&')
11: end
# File lib/www/mechanize/util.rb, line 13
13: def html_unescape(s)
14: return s unless s
15: s.gsub(/&(\w+|#[0-9]+);/) { |match|
16: number = case match
17: when /&(\w+);/
18: Mechanize.html_parser::NamedCharacters[$1]
19: when /&#([0-9]+);/
20: $1.to_i
21: end
22:
23: number ? ([number].pack('U') rescue match) : match
24: }
25: end