Class: Carddav::Url
- Inherits:
-
Object
- Object
- Carddav::Url
- Defined in:
- lib/carddav/url.rb
Instance Method Summary collapse
-
#initialize(uri) ⇒ Url
constructor
A new instance of Url.
- #new(path) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(uri) ⇒ Url
Returns a new instance of Url.
2 3 4 |
# File 'lib/carddav/url.rb', line 2 def initialize(uri) @uri = URI uri end |
Instance Method Details
#new(path) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/carddav/url.rb', line 6 def new(path) return self.class.new path if /^https?:\/\// =~ path uri = @uri.dup uri.path = path.start_with?('/') ? path : "/#{path}" self.class.new uri end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/carddav/url.rb', line 13 def to_s @uri.to_s end |