class Google::Cloud::Storage::File::Updater
Yielded to a block to accumulate changes for a patch request.
Constants
- COPY_ATTRS
@private Whitelist of Google::Apis::StorageV1::Object attributes to be copied when
File#copy
orFile#rewrite
is called with `force_copy_metadata: true`.
Attributes
@private
@private
Public Class Methods
@private Create an Updater
object.
Google::Cloud::Storage::File::new
# File lib/google/cloud/storage/file.rb, line 2164 def initialize gapi super() @updates = [] @gapi = gapi @metadata ||= @gapi.metadata.to_h.dup end
Public Instance Methods
@private Make sure any metadata changes are saved
# File lib/google/cloud/storage/file.rb, line 2198 def check_for_changed_metadata! return if @metadata == @gapi.metadata.to_h @gapi.metadata = @metadata update_gapi! :metadata end
A hash of custom, user-provided web-safe keys and arbitrary string values that will returned with requests for the file as “x-goog-meta-” response headers.
@return [Hash(String => String)]
# File lib/google/cloud/storage/file.rb, line 2178 def metadata @metadata end
Updates the hash of custom, user-provided web-safe keys and arbitrary string values that will returned with requests for the file as “x-goog-meta-” response headers.
@param [Hash(String => String)] metadata The user-provided metadata,
in key/value pairs.
# File lib/google/cloud/storage/file.rb, line 2190 def metadata= metadata @metadata = metadata @gapi.metadata = @metadata update_gapi! :metadata end
Protected Instance Methods
Queue up all the updates instead of making them.
# File lib/google/cloud/storage/file.rb, line 2208 def update_gapi! attribute @updates << attribute @updates.uniq! end