Method: HP::Cloud::SharedResource#parse

Defined in:
lib/hpcloud/shared_resource.rb

#parseObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hpcloud/shared_resource.rb', line 27

def parse()
  @container = nil
  @path = nil
  if @fname.empty?
    return
  end
  #
  # Extract container given the expected input in the form:
  # https://domain_and_port/version/tenant_id/container/object/name/with/slashes.txt
  # where the container for that shared object is:
  # https://domain_and_port/version/tenant_id/container
  # and the path for the object is:
  # object/name/with/slashes.txt
  @container = @fname.match(/http[s]*:\/\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*/).to_s
  @path = @fname.gsub(@container, '')
  @path = @path.gsub(/^\/*/, '')
  @lname = @fname
  @sname = @path
end