Module: Alt::URI::Parse
- Defined in:
- lib/rio/alturi/parse.rb
Constant Summary collapse
- RE_GENERIC =
%r{ (?: ( [^:/?#]+ ) : )? (?: // ( [^/?#]* ) )? ( [^?#]* ) (?: \? ( [^#]* ) )? (?: \# ( .* ) )? }x
- RE_AUTHORITY =
%r{ (?: ( [^@]+ ) @ )? ( [^:]* ) (?: : ( .* ) )? }x
- RE_USERINFO =
%r{ (?: ( [^:]+ ) )? (?: : ( .* ) )? }x
Class Method Summary collapse
- .parse_authority(ustr) ⇒ Object
- .parse_re(str, re, parts = nil) ⇒ Object
- .set_named_match_fields(obj, m, re) ⇒ Object
Class Method Details
.parse_authority(ustr) ⇒ Object
37 38 39 |
# File 'lib/rio/alturi/parse.rb', line 37 def self.(ustr) parse_re(ustr,RE_AUTHORITY) end |
.parse_re(str, re, parts = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rio/alturi/parse.rb', line 11 def self.parse_re(str,re,parts = nil) re.match(str) { |m| parts ||= Parts.new set_named_match_fields(parts,m,re) } end |
.set_named_match_fields(obj, m, re) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/rio/alturi/parse.rb', line 4 def self.set_named_match_fields(obj,m,re) re.names.each do |name| obj.__send__(name+'=',m[name]) end obj end |