Module: AWS::S3::PrefixedCollection
- Defined in:
- lib/aws/s3/prefixed_collection.rb
Instance Attribute Summary collapse
-
#prefix ⇒ String?
readonly
The prefix of this collection.
Instance Method Summary collapse
-
#with_prefix(prefix, mode = :replace) ⇒ Collection
Returns a new collection with a different prefix.
Instance Attribute Details
#prefix ⇒ String? (readonly)
Returns The prefix of this collection.
32 33 34 |
# File 'lib/aws/s3/prefixed_collection.rb', line 32 def prefix @prefix end |
Instance Method Details
#with_prefix(prefix, mode = :replace) ⇒ Collection
Returns a new collection with a different prefix
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/aws/s3/prefixed_collection.rb', line 61 def with_prefix prefix, mode = :replace new_prefix = case mode when :replace then prefix when :append then "#{@prefix}#{prefix}" when :prepend then "#{prefix}#{@prefix}" else raise ArgumentError, "invalid prefix mode `#{mode}`, it must be " + ":replace, :append or :prepend" end self.class.new(bucket, :prefix => new_prefix) end |