Class: Gcloud::Storage::File::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/gcloud/storage/file.rb

Overview

Yielded to a block to accumulate changes for a patch request.

Constant Summary collapse

ATTRS =
[:cache_control, :content_disposition, :content_encoding,
:content_language, :content_type, :metadata]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Updater

Create an Updater object.


764
765
766
767
768
769
770
771
# File 'lib/gcloud/storage/file.rb', line 764

def initialize 
  @metadata = if .nil?
                {}
              else
                .dup
              end
  @updates = {}
end

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates


761
762
763
# File 'lib/gcloud/storage/file.rb', line 761

def updates
  @updates
end

Instance Method Details

#metadataObject

Return metadata for mutation. Also adds metadata to @updates so that it is included in the patch request.


785
786
787
# File 'lib/gcloud/storage/file.rb', line 785

def 
  updates[:metadata] ||= @metadata
end