Class: Google::Cloud::Storage::Policy::Bindings
- Inherits:
-
Object
- Object
- Google::Cloud::Storage::Policy::Bindings
- Includes:
- Enumerable
- Defined in:
- lib/google/cloud/storage/policy/bindings.rb
Overview
Bindings
Enumerable object for managing Cloud IAM bindings associated with a bucket.
Instance Method Summary collapse
-
#each {|binding| ... } ⇒ Enumerator
Calls the block once for each binding in the collection, passing a Binding object as parameter.
-
#insert(*bindings) ⇒ Bindings
Adds a binding or bindings to the collection.
-
#remove(*bindings) ⇒ Bindings
Deletes the binding or bindings from the collection that are equal to the arguments.
Instance Method Details
#each {|binding| ... } ⇒ Enumerator
Calls the block once for each binding in the collection, passing a Google::Cloud::Storage::Policy::Binding object as parameter. A Google::Cloud::Storage::Policy::Binding object is passed even when the arguments to #insert were hash objects.
If no block is given, an enumerator is returned instead.
171 172 173 174 175 |
# File 'lib/google/cloud/storage/policy/bindings.rb', line 171 def each &block return enum_for :each unless block_given? @bindings.each(&block) end |
#insert(*bindings) ⇒ Bindings
Adds a binding or bindings to the collection. The arguments may be Google::Cloud::Storage::Policy::Binding objects or equivalent hash objects that will be implicitly coerced to binding objects.
100 101 102 103 104 |
# File 'lib/google/cloud/storage/policy/bindings.rb', line 100 def insert *bindings bindings = coerce_bindings(*bindings) @bindings += bindings self end |
#remove(*bindings) ⇒ Bindings
Deletes the binding or bindings from the collection that are equal to the arguments. The specification arguments may be Google::Cloud::Storage::Policy::Binding objects or equivalent hash objects that will be implicitly coerced to binding objects.
139 140 141 142 143 |
# File 'lib/google/cloud/storage/policy/bindings.rb', line 139 def remove *bindings bindings = coerce_bindings(*bindings) @bindings -= bindings self end |