Method: OpenStack::Swift::StorageObject#initialize
- Defined in:
- lib/openstack/swift/storage_object.rb
#initialize(container, objectname, force_exists = false) ⇒ StorageObject
Builds a new OpenStack::Swift::StorageObject in the specified container. If force_exist is set, the object must exist or a OpenStack::Exception::ItemNotFound will be raised. If not, an “empty” StorageObject will be returned, ready for data via the write method
The container parameter must be an OpenStack::Swift::Container object.
This constructor is typically not called directly. You can get a reference to an existing Object via OpenStack::Swift::Container::object method or create a new Object via OpenStack::Swift::Container::create_object method
25 26 27 28 29 30 31 32 33 |
# File 'lib/openstack/swift/storage_object.rb', line 25 def initialize(container, objectname, force_exists = false) @container = container @containername = container.name @name = objectname if force_exists raise OpenStack::Exception::ItemNotFound.new("No Object \"#{@name}\" found in Container \"#{@containername}\"", "404", "") unless container.object_exists?(objectname) end end |