Class: AWS::S3::Tree::LeafNode
- Defined in:
- lib/aws/s3/tree/leaf_node.rb
Overview
Generally you do not need to create leaf nodes
Represents a leaf in an AWS::S3::Tree.
When enumerating nodes in an S3 tree, keys are yielded as leaf nodes (they have no children beneath them).
Instance Attribute Summary collapse
-
#member ⇒ mixed
readonly
Returns the object this leaf node represents.
-
#parent ⇒ Tree, BranchNode
readonly
The parent node in the tree.
Instance Method Summary collapse
- #branch? ⇒ false
-
#initialize(parent, member) ⇒ LeafNode
constructor
A new instance of LeafNode.
- #inspect ⇒ Object
-
#key ⇒ String
The key this leaf node represents.
- #leaf? ⇒ true
-
#object ⇒ S3Object
The object this leaf node represents.
-
#upload ⇒ MultipartUpload
Returns the object version this leaf node represents.
-
#version ⇒ ObjectVersion
Returns the object version this leaf node represents.
Constructor Details
#initialize(parent, member) ⇒ LeafNode
Returns a new instance of LeafNode.
28 29 30 31 32 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 28 def initialize parent, member @parent = parent @member = member super() end |
Instance Attribute Details
#member ⇒ mixed (readonly)
Returns the object this leaf node represents.
41 42 43 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 41 def member @member end |
#parent ⇒ Tree, BranchNode (readonly)
Returns The parent node in the tree.
35 36 37 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 35 def parent @parent end |
Instance Method Details
#branch? ⇒ false
49 50 51 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 49 def branch? false end |
#inspect ⇒ Object
87 88 89 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 87 def inspect "<#{self.class}:#{@member.bucket.name}:#{key}>" end |
#key ⇒ String
Returns the key this leaf node represents.
44 45 46 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 44 def key @member.key end |
#leaf? ⇒ true
54 55 56 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 54 def leaf? true end |
#object ⇒ S3Object
Returns The object this leaf node represents.
59 60 61 62 63 64 65 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 59 def object if @member.kind_of?(S3Object) @member else @member.object end end |
#upload ⇒ MultipartUpload
Returns the object version this leaf node represents.
79 80 81 82 83 84 85 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 79 def upload if @member.kind_of?(MultipartUpload) @member else raise "This leaf does not represent an upload" end end |
#version ⇒ ObjectVersion
Returns the object version this leaf node represents.
69 70 71 72 73 74 75 |
# File 'lib/aws/s3/tree/leaf_node.rb', line 69 def version if @member.kind_of?(ObjectVersion) @member else raise "This leaf does not represent a version" end end |