Rufus::Jig

for #


Constants

URI_REGEX
VERSION

Public Class Methods

marshal_copy(o) click to toggle source

The classical helper method, does a full copy of the given object. Thanks Marshal.

    # File lib/rufus/jig/http.rb, line 38
38:   def self.marshal_copy (o)
39: 
40:     Marshal.load(Marshal.dump(o))
41:   end
parse_host(s) click to toggle source

The current URI lib is not UTF-8 friendly, so this is a workaround. Temporary hopefully.

     # File lib/rufus/jig/http.rb, line 103
103:   def self.parse_host (s)
104: 
105:     u = parse_uri(s)
106: 
107:     u ? u.host : nil
108:   end
parse_uri(s) click to toggle source

The current URI lib is not UTF-8 friendly, so this is a workaround. Temporary hopefully.

    # File lib/rufus/jig/http.rb, line 77
77:   def self.parse_uri (s)
78: 
79:     m = URI_REGEX.match(s)
80: 
81:     host, port, path, query = if m
82: 
83:       h, p = m[1].split(':')
84:       p ||= 80
85: 
86:       query = m[3] ? m[3][1..1] : nil
87: 
88:       [ h, p, m[2], query ]
89: 
90:     else
91: 
92:       p, q = s.split('?')
93: 
94:       [ nil, nil, p, q ]
95:     end
96: 
97:     OpenStruct.new(:host => host, :port => port, :path => path, :query => query)
98:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.