rtree 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rtree.rb +10 -5
  3. data/lib/rtree/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5186130df47a6485f3e3cc5d8238ecc918aaa94
4
- data.tar.gz: 007abb7186d327c7a5f98710c77c418f2eddb312
3
+ metadata.gz: 118636b86b0f88075e466e33d505619520b547d2
4
+ data.tar.gz: 8bdec3203c1ee5445a249fc6565f0bedade34540
5
5
  SHA512:
6
- metadata.gz: 98fe9a1c3643256792f0b9d4dca1c0cdef107071f4648edb745d9ab8a844f3cd573fe03b4f049a1a0e4de2e64125b9cfb41fb6d5e99f7d0f033d3886760c334f
7
- data.tar.gz: 694b42820a444775fc9f1a2e1250abac6e4c9ea925bd5586f32518e944434b34eb13b0ef37cb7a44634eac73b1fd0a37cafe12c28b243658702cf6d40968a368
6
+ metadata.gz: 8dde77521b9964c36429fa038db6db21c605d763a623ad609413c8df03d3244c70ab419810afe57d47bfb9753d1e38f0c5582e720fae4e537371be347a910e7f
7
+ data.tar.gz: 0a841dce97dbf06b113cb4bd59d1f92bfc15a68852e1de8200cf69867fb216cdfa3eb575389d88de21cda26609bfeb7531691c5ed9bdf5c25193e6646be024a2
@@ -1,16 +1,21 @@
1
1
  require "rtree/version"
2
2
 
3
3
  class Dir
4
- def Dir.tree(dir = ".",options={:level=>nil},nesting=0)
4
+ def Dir.tree(dir = ".",options={:level=>nil},nesting=0,output='')
5
5
  options[:level]||=nil
6
6
  options[:show_hidden]=false if options[:show_hidden].nil?
7
7
  Dir.foreach(dir) do |entry|
8
8
  next if ['.','..'].include?(entry)
9
- next if entry =~ /^\./ && !options[:show_hidden]
10
- puts "| " * nesting + "|-- #{entry}"
11
- if File.stat(d = "#{dir}#{File::SEPARATOR}#{entry}").directory?
12
- tree(d, options,nesting+1) if options[:level].nil? || (nesting+1)<options[:level]
9
+ next if entry =~ /^\./ && !options[:show_hidden]
10
+ line = "| " * nesting + "|-- #{entry}"
11
+ full_path="#{dir}#{File::SEPARATOR}#{entry}"
12
+ line << " -> #{File.readlink(full_path)}" if File.symlink?(full_path)
13
+ puts line
14
+ output<<line<<"\n"
15
+ if File.directory?(full_path) && !File.symlink?(full_path)
16
+ tree(full_path, options,nesting+1) if options[:level].nil? || (nesting+1)<options[:level]
13
17
  end
14
18
  end
19
+ output
15
20
  end
16
21
  end
@@ -1,3 +1,3 @@
1
1
  module Rtree
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - qjpcpu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-10 00:00:00.000000000 Z
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler