Module: AWS::IAM::Collection::WithPrefix
- Includes:
- AWS::IAM::Collection
- Included in:
- GroupCollection, ServerCertificateCollection, UserCollection
- Defined in:
- lib/aws/iam/collection.rb
Overview
Common methods for collection classes that can be filtered by a path prefix.
Instance Attribute Summary collapse
-
#prefix ⇒ String
readonly
The path prefix by which the collection is filtered.
Instance Method Summary collapse
- #each(options = {}, &block) ⇒ Object
-
#with_prefix(prefix) ⇒ GroupCollection
Returns a collection object including only those groups whose paths begin with the supplied prefix.
Instance Attribute Details
#prefix ⇒ String (readonly)
Returns The path prefix by which the collection is filtered.
30 31 32 |
# File 'lib/aws/iam/collection.rb', line 30 def prefix @prefix end |
Instance Method Details
#each(options = {}, &block) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/aws/iam/collection.rb', line 38 def each = {}, &block = { :path_prefix => prefix }.merge() if prefix [:path_prefix] = .delete(:prefix) if .key?(:prefix) if prefix = [:path_prefix] [:path_prefix] = "/#{prefix}".sub(%r{^//}, "/") end super(, &block) end |
#with_prefix(prefix) ⇒ GroupCollection
Returns a collection object including only those groups whose paths begin with the supplied prefix.
57 58 59 60 61 |
# File 'lib/aws/iam/collection.rb', line 57 def with_prefix(prefix) prefix = "/#{prefix}".sub(%r{^//}, "/") self.class.new(:prefix => prefix, :config => config) end |