Class: AWS::S3::Tree::BranchNode
- Includes:
- Parent
- Defined in:
- lib/aws/s3/tree/branch_node.rb
Overview
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.
Instance Attribute Summary collapse
-
#parent ⇒ Tree, BranchNode
readonly
The parent node in the tree.
Attributes included from Parent
#collection, #delimiter, #prefix
Attributes included from Core::Model
Instance Method Summary collapse
-
#as_tree ⇒ Tree
Returns a new Tree object that starts at this branch node.
- #branch? ⇒ true
-
#initialize(parent, collection, options = {}) ⇒ BranchNode
constructor
A new instance of BranchNode.
- #leaf? ⇒ false
Methods included from Parent
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, = {} @parent = parent super(collection, .merge(:prefix => collection.prefix)) end |
Instance Attribute Details
#parent ⇒ Tree, BranchNode (readonly)
Returns The parent node in the tree.
41 42 43 |
# File 'lib/aws/s3/tree/branch_node.rb', line 41 def parent @parent end |
Instance Method Details
#as_tree ⇒ Tree
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.
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
44 45 46 |
# File 'lib/aws/s3/tree/branch_node.rb', line 44 def branch? true end |
#leaf? ⇒ false
49 50 51 |
# File 'lib/aws/s3/tree/branch_node.rb', line 49 def leaf? false end |