Class: Gcloud::Storage::Bucket::Updater
- Inherits:
-
Object
- Object
- Gcloud::Storage::Bucket::Updater
- Defined in:
- lib/gcloud/storage/bucket.rb
Overview
Yielded to a block to accumulate changes for a patch request.
Constant Summary collapse
- ATTRS =
[:cors, :logging_bucket, :logging_prefix, :versioning, :website_main, :website_404]
Instance Attribute Summary collapse
-
#updates ⇒ Object
readonly
Returns the value of attribute updates.
Instance Method Summary collapse
-
#cors ⇒ Object
Return CORS for mutation.
-
#initialize(cors) ⇒ Updater
constructor
Create an Updater object.
Constructor Details
#initialize(cors) ⇒ Updater
Create an Updater object.
793 794 795 796 797 |
# File 'lib/gcloud/storage/bucket.rb', line 793 def initialize cors @cors = cors ? Array(cors.dup) : [] @cors = @cors.map { |x| x.to_hash if x.respond_to? :to_hash } @updates = {} end |
Instance Attribute Details
#updates ⇒ Object (readonly)
Returns the value of attribute updates.
790 791 792 |
# File 'lib/gcloud/storage/bucket.rb', line 790 def updates @updates end |
Instance Method Details
#cors ⇒ Object
Return CORS for mutation. Also adds CORS to @updates so that it is included in the patch request.
811 812 813 814 815 816 817 818 819 |
# File 'lib/gcloud/storage/bucket.rb', line 811 def cors updates[:cors] ||= @cors if block_given? cors_builder = Bucket::Cors.new updates[:cors] yield cors_builder updates[:cors] = cors_builder if cors_builder.changed? end updates[:cors] end |