Module: AWS::S3::ACL::S3Object

Defined in:
lib/aws/s3/acl.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

:nodoc:



539
540
541
# File 'lib/aws/s3/acl.rb', line 539

def self.included(klass) #:nodoc:
  klass.extend(ClassMethods)
end

Instance Method Details

#acl(reload = false) ⇒ Object

The acl method returns and updates the acl for a given s3 object.

# Fetch a the object
object = S3Object.find 'kiss.jpg', 'marcel'

# Add a grant to the object's
object.acl.grants << some_grant

# Write the changes to the policy
object.acl(object.acl)


580
581
582
583
584
585
586
# File 'lib/aws/s3/acl.rb', line 580

def acl(reload = false)
  policy = reload.is_a?(ACL::Policy) ? reload : nil
  memoize(reload) do
    self.class.acl(key, bucket.name, policy) if policy
    self.class.acl(key, bucket.name)
  end
end