Method: HP::Cloud::Resource#parse

Defined in:
lib/hpcloud/resource.rb

#parseObject



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/hpcloud/resource.rb', line 100

def parse
  @container = nil
  @path = nil
  if @fname.empty?
    return
  end
  if @fname[0,1] == ':'
    @container, *rest = @fname.split('/')
    @container = @container[1..-1] if @container[0,1] == ':'
    @path = rest.empty? ? '' : rest.join('/')
    unless @container.length < 257
      raise Exception.new("Valid container names must be less than 256 characters long")
    end
  else
    rest = @fname.split('/')
    @path = rest.empty? ? '' : rest.join('/')
  end
end