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.



810
811
812
813
814
815
816
817
# File 'lib/gcloud/storage/file.rb', line 810

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

Instance Attribute Details

#updatesObject (readonly)

Returns the value of attribute updates.



807
808
809
# File 'lib/gcloud/storage/file.rb', line 807

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.



831
832
833
# File 'lib/gcloud/storage/file.rb', line 831

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