class Anaximander::Url
Attributes
uri[R]
Public Class Methods
new(uri)
click to toggle source
Calls superclass method
# File lib/anaximander/url.rb, line 7 def initialize(uri) @uri = URI(uri.to_s) super(@uri) end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/anaximander/url.rb, line 30 def <=>(other) other.respond_to?(:uri) ? self.uri <=> other.uri : self.uri.to_s <=> other end
absolute(base)
click to toggle source
# File lib/anaximander/url.rb, line 22 def absolute(base) absolute? ? self : Url.new(base).join(self) end
base()
click to toggle source
# File lib/anaximander/url.rb, line 12 def base domain = "#{scheme}://#{host}" domain += ":#{port}" unless port == 80 domain end
eql?(other)
click to toggle source
# File lib/anaximander/url.rb, line 34 def eql?(other) self.uri.eql?(other.uri) end
join(url)
click to toggle source
# File lib/anaximander/url.rb, line 18 def join(url) self.class.new(URI.join(self.uri, url.to_s)) end
without_fragment()
click to toggle source
# File lib/anaximander/url.rb, line 26 def without_fragment self.class.new(self).tap { |url| url.fragment = nil } end