class AWS::S3::Tree::LeafNode

Represents a leaf in an {S3::Tree}.

When enumerating nodes in an S3 tree, keys are yielded as leaf nodes (they have no children beneath them).

@see Tree @note Generally you do not need to create leaf nodes

Attributes

member[R]

@return [mixed] Returns the object this leaf node represents. @see object @see version @see upload

parent[R]

@return [Tree, BranchNode] The parent node in the tree.

Public Class Methods

new(parent, member) click to toggle source

@private

# File lib/aws/s3/tree/leaf_node.rb, line 28
def initialize parent, member
  @parent = parent
  @member = member
  super()
end

Public Instance Methods

branch?() click to toggle source

@return [false]

# File lib/aws/s3/tree/leaf_node.rb, line 49
def branch?
  false
end
inspect() click to toggle source
# File lib/aws/s3/tree/leaf_node.rb, line 87
def inspect
  "<#{self.class}:#{@member.bucket.name}:#{key}>"
end
key() click to toggle source

@return [String] the key this leaf node represents.

# File lib/aws/s3/tree/leaf_node.rb, line 44
def key
  @member.key
end
leaf?() click to toggle source

@return [true]

# File lib/aws/s3/tree/leaf_node.rb, line 54
def leaf?
  true
end
object() click to toggle source

@return [S3Object] The object this leaf node represents.

# File lib/aws/s3/tree/leaf_node.rb, line 59
def object
  if @member.kind_of?(S3Object)
    @member
  else
    @member.object
  end
end
upload() click to toggle source

@return [MultipartUpload] Returns the object version this leaf

node represents.
# 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() click to toggle source

@return [ObjectVersion] Returns the object version this leaf

node represents.
# 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