Class: DataObjects::URI
- Defined in:
- lib/mack-data_mapper/dm_patches/uri.rb,
lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb,
lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb
Overview
:nodoc:
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.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Struct
Instance Attribute Details
#fragment ⇒ Object
Returns the value of attribute fragment
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def fragment @fragment end |
#host ⇒ Object
Returns the value of attribute host
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def host @host end |
#password ⇒ Object
Returns the value of attribute password
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def password @password end |
#path ⇒ Object
Returns the value of attribute path
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def path @path end |
#port ⇒ Object
Returns the value of attribute port
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def port @port end |
#query ⇒ Object
Returns the value of attribute query
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def query @query end |
#scheme ⇒ Object
Returns the value of attribute scheme
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def scheme @scheme end |
#user ⇒ Object
Returns the value of attribute user
5 6 7 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 5 def user @user end |
Class Method Details
.parse(uri) ⇒ Object
8 9 10 11 12 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 8 def self.parse(uri) return uri if uri.kind_of?(self) uri = Addressable::URI::parse(uri) unless uri.kind_of?(Addressable::URI) self.new(uri.scheme, uri.user, uri.password, uri.host, uri.port, uri.path, uri.query_values, uri.fragment) end |
Instance Method Details
#basename ⇒ Object
4 5 6 |
# File 'lib/mack-data_mapper/dm_patches/uri.rb', line 4 def basename self.path[1..self.path.length] end |
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gems/data_objects-0.9.10.1/lib/data_objects/uri.rb', line 14 def to_s string = "" string << "#{scheme}://" if scheme if user string << "#{user}" string << ":#{password}" if password string << "@" end string << "#{host}" if host string << ":#{port}" if port string << path.to_s if query string << "?" << query.map do |key, value| "#{key}=#{value}" end.join("&") end string << "##{fragment}" if fragment string end |