module AWS::S3::PrefixedCollection
def with_prefix prefix, mode = :replace
-
(Collection)
- Returns a new collection with a modified prefix.
Parameters:
-
mode
(Symbol
) -- (:replace) If you chain calls to #with_prefix -
prefix
(String
) -- The prefix condition that limits what objects
Other tags:
- Example: Chaining with_prefix with :prepend -
Example: Chaining with_prefix with :append -
Example: Chaining with_prefix replaces previous prefix -
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