Class: Carddav::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/carddav/url.rb

Instance Method Summary collapse

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_sObject



13
14
15
# File 'lib/carddav/url.rb', line 13

def to_s
  @uri.to_s
end