class AWS::S3::Tree::ChildCollection

def append?

Returns:
  • (Boolean) - Returns true if the tree is set to auto-append
def append?
  @append
end

def each &block

Returns:
  • (nil) -

Other tags:
    Yieldparam: tree_node - A branch or a leaf.

Other tags:
    Yield: - Yields up a mixture of branches and leafs.
def each &block
  collection = self.collection
  if prefix = prefix_with_delim
    collection = collection.with_prefix(prefix)
  end
  collection.each(:delimiter => delimiter) do |member|
    case
    when member.respond_to?(:key)
      yield LeafNode.new(parent, member)
    when member.respond_to?(:prefix)
      yield BranchNode.new(parent, member,
                           :delimiter => delimiter,
                           :append => append?)
    end
  end
  nil
end

def initialize parent, collection, options = {}

Other tags:
    Private: -
def initialize parent, collection, options = {}
  options = { 
    :prefix => nil,
    :delimiter => '/', 
    :append => true,
  }.merge(options)
  @parent = parent
  @collection = collection
  @prefix = options[:prefix]
  @delimiter = options[:delimiter]
  @append = options[:append]
  super
end

def prefix_with_delim

def prefix_with_delim
  return prefix unless append?
  return nil if prefix.nil?
  prefix =~ /#{delimiter}$/ ? prefix : "#{prefix}#{delimiter}"
end