Method: CloudFiles::StorageObject#initialize
- Defined in:
- lib/cloudfiles/storage_object.rb
#initialize(container, objectname, force_exists = false, make_path = false) ⇒ StorageObject
Builds a new CloudFiles::StorageObject in the current container. If force_exist is set, the object must exist or a CloudFiles::Exception::NoSuchObject Exception will be raised. If not, an “empty” CloudFiles::StorageObject will be returned, ready for data via CloudFiles::StorageObject.write
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cloudfiles/storage_object.rb', line 15 def initialize(container, objectname, force_exists = false, make_path = false) @container = container @containername = container.name @name = objectname @make_path = make_path @storagepath = "#{CloudFiles.escape @containername}/#{CloudFiles.escape @name, '/'}" if force_exists raise CloudFiles::Exception::NoSuchObject, "Object #{@name} does not exist" unless container.object_exists?(objectname) end end |