Method: COS::COSDir#tree

Defined in:
lib/cos/dir.rb

#tree(options = {}) ⇒ Hash

获取当前目录树形结构

:resource => resource,
:children => [
  {:resource => resource, :children => [...],
  => resource, :children => [...],
  ...
]

}

Examples:

tree = dir.tree
puts tree[:resource].name
tree[:children].each do |r|
  puts r[:resource].name
end

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :depth (Integer)

    子目录深度,默认为5

Returns:

  • (Hash)

Raises:



203
204
205
# File 'lib/cos/dir.rb', line 203

def tree(options = {})
  bucket.tree(self, options)
end