Class: Rufus::Jig::Uri
- Inherits:
-
Object
- Object
- Rufus::Jig::Uri
- Defined in:
- lib/rufus/jig/http.rb
Overview
Rufus::Jig.parse_uri returns instances of this class.
Instance Attribute Summary collapse
-
#fragment ⇒ Object
Returns the value of attribute fragment.
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#query ⇒ Object
Returns the value of attribute query.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(sc, us, ps, ho, po, pa, qu, fr) ⇒ Uri
constructor
A new instance of Uri.
- #tail_to_s ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(sc, us, ps, ho, po, pa, qu, fr) ⇒ Uri
Returns a new instance of Uri.
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rufus/jig/http.rb', line 108 def initialize(sc, us, ps, ho, po, pa, qu, fr) @scheme = sc @username = us @password = ps @host = ho @port = po @path = pa @query = qu @fragment = fr end |
Instance Attribute Details
#fragment ⇒ Object
Returns the value of attribute fragment.
106 107 108 |
# File 'lib/rufus/jig/http.rb', line 106 def fragment @fragment end |
#host ⇒ Object
Returns the value of attribute host.
105 106 107 |
# File 'lib/rufus/jig/http.rb', line 105 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
104 105 106 |
# File 'lib/rufus/jig/http.rb', line 104 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
106 107 108 |
# File 'lib/rufus/jig/http.rb', line 106 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
105 106 107 |
# File 'lib/rufus/jig/http.rb', line 105 def port @port end |
#query ⇒ Object
Returns the value of attribute query.
106 107 108 |
# File 'lib/rufus/jig/http.rb', line 106 def query @query end |
#scheme ⇒ Object
Returns the value of attribute scheme.
103 104 105 |
# File 'lib/rufus/jig/http.rb', line 103 def scheme @scheme end |
#username ⇒ Object
Returns the value of attribute username.
104 105 106 |
# File 'lib/rufus/jig/http.rb', line 104 def username @username end |
Instance Method Details
#tail_to_s ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/rufus/jig/http.rb', line 132 def tail_to_s tail = @path tail = "#{tail}?#{@query}" if @query tail = "#{tail}##{@fragment}" if @fragment tail end |
#to_s ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/rufus/jig/http.rb', line 120 def to_s tail = tail_to_s return tail unless @host up = '' up = "#{@username}:#{password}@" if @username "#{@scheme}://#{up}#{@host}:#{@port}#{tail}" end |