Class: AWS::S3::Tree::BranchNode

Inherits:
Node
  • Object
show all
Includes:
Parent
Defined in:
lib/aws/s3/tree/branch_node.rb

Overview

Note:

Generally you do not need to create branch nodes.

Represents a branch in an AWS::S3::Tree. From a branch node you can descend deeper into the tree using Parent#children or go back to the parent node using #parent.

When enumerating nodes in an S3 tree keys grouped by a common prefix are represented as a branch node.

Branch nodes are often treated like directories.

See Also:

Instance Attribute Summary collapse

Attributes included from Parent

#collection, #delimiter, #prefix

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from Parent

#append?, #children, #inspect

Methods included from Core::Model

#client, #config_prefix, #inspect

Constructor Details

#initialize(parent, collection, options = {}) ⇒ BranchNode

Returns a new instance of BranchNode.



34
35
36
37
38
# File 'lib/aws/s3/tree/branch_node.rb', line 34

def initialize parent, collection, options = {}
  @parent = parent
  super(collection,
        options.merge(:prefix => collection.prefix))
end

Instance Attribute Details

#parentTree, BranchNode (readonly)

Returns The parent node in the tree.

Returns:



41
42
43
# File 'lib/aws/s3/tree/branch_node.rb', line 41

def parent
  @parent
end

Instance Method Details

#as_treeTree

Returns a new Tree object that starts at this branch node. The returned tree will have the same prefix, delimiter and append mode as the tree the branch belongs to.

Returns:



58
59
60
61
62
63
# File 'lib/aws/s3/tree/branch_node.rb', line 58

def as_tree
  Tree.new(collection,
           :prefix => prefix,
           :delimiter => delimiter,
           :append => append?)
end

#branch?true

Returns:

  • (true)


44
45
46
# File 'lib/aws/s3/tree/branch_node.rb', line 44

def branch?
  true
end

#leaf?false

Returns:

  • (false)


49
50
51
# File 'lib/aws/s3/tree/branch_node.rb', line 49

def leaf?
  false
end