fagin 1.1.3 → 1.2.0
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/lib/fagin.rb +19 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eec106dd94688b510c32827ba3dcddc7f2bc341907e2889d2890071cb6b93db
|
4
|
+
data.tar.gz: e9f5210e8f58c05d164c28266089d97bb3209af669fea13dbe7baf85608119a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c2411155c4b8d9354c274a1f2401f90fa362273185366a55a69e874e30b74d54507c2c2168d584e8f6d4c904520e493350abaac2c7a765d9fa7d131c703a4f7
|
7
|
+
data.tar.gz: bd6c75e508d40e81189d3939d9fd4e877bf36162a24005238edce3728ed64e9ff9d2186c30325fdacbace71b33e485524af7691c9bb3ac440e2643b9f39bef1d
|
data/lib/fagin.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require "pathname"
|
2
2
|
|
3
3
|
class Fagin
|
4
|
-
def self.find_children(
|
4
|
+
def self.find_children(
|
5
|
+
parent,
|
6
|
+
dir,
|
7
|
+
recursive = false,
|
8
|
+
withfile = false
|
9
|
+
)
|
5
10
|
children = Hash.new
|
6
11
|
path = Pathname.new(dir).expand_path
|
7
12
|
return children if (!path.exist?)
|
@@ -21,7 +26,11 @@ class Fagin
|
|
21
26
|
child = clas.split("::").inject(Object) do |m, c|
|
22
27
|
m.const_get(c)
|
23
28
|
end
|
24
|
-
|
29
|
+
if (withfile)
|
30
|
+
children[clas] = [child, file]
|
31
|
+
else
|
32
|
+
children[clas] = child
|
33
|
+
end
|
25
34
|
rescue NameError
|
26
35
|
raise Error::UnknownChildClass.new(clas)
|
27
36
|
end
|
@@ -34,6 +43,14 @@ class Fagin
|
|
34
43
|
def self.find_children_recursively(parent, dir)
|
35
44
|
return find_children(parent, dir, true)
|
36
45
|
end
|
46
|
+
|
47
|
+
def self.find_children_with_file(parent, dir)
|
48
|
+
return find_children(parent, dir, false, true)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.find_children_with_file_recursively(parent, dir)
|
52
|
+
return find_children(parent, dir, true, true)
|
53
|
+
end
|
37
54
|
end
|
38
55
|
|
39
56
|
require "fagin/error"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fagin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|