filetree 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/examples/simple_filetree.rb +1 -1
- data/filetree.gemspec +1 -1
- data/lib/filetree.rb +10 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83caa925feb3d507378725abfb1ce9d716bf8feb
|
4
|
+
data.tar.gz: 6a2fedebf430894e6060da4853f7ec51b6d81026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc66fe7961828d31cdc9886b775782d5286c1ba584d2bb06870ab296e6859c3d01f4a7f8488f1c517399a865dca794821674c99ef75d56ad26757e641f30220a
|
7
|
+
data.tar.gz: e4d5b096363991caa752d655a6e51d85fb03425fdc78697b33e3a6962c3b8ce3fe1b6c55f2254a0a9c457b945f476030bd402b4b568cca29e57d81f96a8373d8
|
data/README.md
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
A simple tree structure for working with FilePath objects in ruby. I simply took the simple_tree module from https://github.com/ealdent/simple-tree and hacked it into [Pathname](http://www.ruby-doc.org/stdlib-2.0/libdoc/pathname/rdoc/Pathname.html) from the std-lib. This means you get all the awesome features of working with Pathname, as well as making it easy to examine a filepath's ancestors and descendants.
|
4
4
|
|
5
|
+
# Usage
|
6
|
+
|
5
7
|
## Install
|
6
8
|
|
7
9
|
install with: `gem install filetree`
|
8
10
|
|
9
|
-
|
10
|
-
# Usage
|
11
|
+
## Examples
|
11
12
|
|
12
13
|
```ruby
|
13
14
|
|
@@ -71,6 +72,10 @@ install with: `gem install filetree`
|
|
71
72
|
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/test3/no>
|
72
73
|
|
73
74
|
```
|
75
|
+
# Documentation
|
76
|
+
|
77
|
+
View the [docs](http://rubydoc.info/gems/filetree).
|
78
|
+
|
74
79
|
# Credits
|
75
80
|
|
76
81
|
All credit belongs to the following persons, I just cobbled this together from their work:
|
data/examples/simple_filetree.rb
CHANGED
@@ -39,7 +39,7 @@ des_arr = tree.descendants.map { |e| FileTree.new(e.relative_path_from(FileTree.
|
|
39
39
|
des_arr.first
|
40
40
|
# => #<FileTree:test/test1/test2/testee>
|
41
41
|
|
42
|
-
des_arr.last.ancestors # infinite loop. "ancestors" depends on hitting "/" to stop.
|
42
|
+
# des_arr.last.ancestors # infinite loop. "ancestors" depends on hitting "/" to stop.
|
43
43
|
|
44
44
|
# the "tree_rep" method provides prettyprinting for creating your own to_s methods
|
45
45
|
puts tree.tree_rep
|
data/filetree.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'filetree'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.3'
|
4
4
|
s.date = '2013-05-27'
|
5
5
|
s.summary = "A simple ruby library for manipulating filepaths as tree structures"
|
6
6
|
s.description = "A simple tree structure for working with FilePath objects in ruby. I simply took the simple_tree module from https://github.com/ealdent/simple-tree and hacked it into Pathname (http://www.ruby-doc.org/stdlib-2.0/libdoc/pathname/rdoc/Pathname.html) from the std-lib. This means you get all the awesome features of working with Pathname, as well as making it easy to examine a filepath's ancestors and descendants."
|
data/lib/filetree.rb
CHANGED
@@ -23,14 +23,20 @@ class FileTree < Pathname
|
|
23
23
|
@identifier ||= self.inspect
|
24
24
|
end
|
25
25
|
|
26
|
-
#
|
27
|
-
|
26
|
+
#
|
27
|
+
# See {http://rubydoc.info/stdlib/pathname/Pathname:parent Pathname.parent}
|
28
|
+
#
|
29
|
+
# @return [FileTree] The directory immediately above self.
|
30
|
+
#
|
28
31
|
def parent
|
29
32
|
FileTree.new(_parent)
|
30
33
|
end
|
31
34
|
|
32
|
-
#
|
33
|
-
|
35
|
+
#
|
36
|
+
# See {http://rubydoc.info/stdlib/pathname/Pathname:children Pathname.children}
|
37
|
+
#
|
38
|
+
# @return [Array] an Array of all entries contained in self.
|
39
|
+
#
|
34
40
|
def children(*args)
|
35
41
|
if self.directory?
|
36
42
|
_children(*args)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filetree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric West
|
@@ -51,3 +51,4 @@ signing_key:
|
|
51
51
|
specification_version: 4
|
52
52
|
summary: A simple ruby library for manipulating filepaths as tree structures
|
53
53
|
test_files: []
|
54
|
+
has_rdoc:
|