【文件属性】:
文件名称:ruby-file-tree:将文件转换为 ruby 中的 tress、hash、json
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-13 23:22:05
Ruby
#Ruby 文件树
在 Ruby 中创建一个 FileTree。
@t = FileTree . new ( 'path/to/dir' )
##.to_h 生成哈希的哈希,其键是文件名并且(如果是目录)具有“子”哈希。
@t = FileTree . new ( 'path/to/dir' )
@t . to_h
#=> {"dir1"=>
{ :children =>
{ "file3.txt" =>
{ :children => nil , :type => "file" , :full_path => "test/data/dir1/file3.txt" } } ,
:type => "directory" ,
:full_path => "test/data/dir1" } ,
" dir2 "=>
{:children=>
【文件预览】:
ruby-file-tree-master
----test()
--------data()
--------tree_spec.rb(1KB)
----tree.rb(1KB)
----Readme.md(2KB)