Class: SiteMaps::Builder::Link
- Inherits:
-
Object
- Object
- SiteMaps::Builder::Link
- Defined in:
- lib/site_maps/builder/link.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(base_url, path, params = {}) ⇒ Link
constructor
A new instance of Link.
- #to_s ⇒ Object
Constructor Details
#initialize(base_url, path, params = {}) ⇒ Link
Returns a new instance of Link.
7 8 9 10 11 12 |
# File 'lib/site_maps/builder/link.rb', line 7 def initialize(base_url, path, params = {}) @uri = base_url.is_a?(::URI) ? base_url.dup : ::URI.parse(base_url) @uri.user, @uri.query = nil @uri.path = path @uri.query = Rack::Utils.unescape(Rack::Utils.build_nested_query(params)) if params.is_a?(Hash) && params.any? end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/site_maps/builder/link.rb', line 5 def uri @uri end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
18 19 20 |
# File 'lib/site_maps/builder/link.rb', line 18 def eql?(other) to_s == other.to_s end |
#hash ⇒ Object
23 24 25 |
# File 'lib/site_maps/builder/link.rb', line 23 def hash to_s.hash end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/site_maps/builder/link.rb', line 14 def to_s @uri.to_s end |