module AWS::S3::PrefixedCollection
def initialize *args
- Private: -
def initialize *args options = args.last.is_a?(Hash) ? args.pop : {} @prefix = options[:prefix] args.push(options) super(*args) end
def list_options(options)
def list_options(options) opts = super opts[:prefix] = prefix if prefix opts end
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