fagin 0.1.2 → 1.0.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 +5 -7
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 59bdfaa3eae3de5a50ff4fba0ec0583434243915
|
|
4
|
+
data.tar.gz: 4c1778cc02346efb385779365fab492c5e0df407
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1515137a0998eabdf7242f0ac9cf91621045e11d53f7c36eddbbaafafd56956de66e7a46e28375dff2b4646dce9bbc31d1a183d76f1d3cdee4605629c8e109c
|
|
7
|
+
data.tar.gz: 67054e78b542e9ee968eb9d3234cb932170e1518b8022991b6a12c1e3c1217298990159f11b0641bb0400ff1b5679151cc03369e8cf0cfe7379a01998e0d2b75
|
data/lib/fagin.rb
CHANGED
|
@@ -6,25 +6,23 @@ class Fagin
|
|
|
6
6
|
path = Pathname.new(dir).expand_path
|
|
7
7
|
|
|
8
8
|
Dir["#{path}/*.rb"].each do |file|
|
|
9
|
-
require_relative file
|
|
10
|
-
|
|
11
9
|
%x(
|
|
12
|
-
\grep -E "^class .+
|
|
10
|
+
\grep -E "^class .+ < #{parent}" #{file} | \
|
|
13
11
|
awk '{print $2}'
|
|
14
12
|
).each_line do |clas|
|
|
15
13
|
next if (clas.nil?)
|
|
16
14
|
clas.strip!
|
|
17
|
-
next if (clas.
|
|
15
|
+
next if (clas.empty?)
|
|
18
16
|
|
|
19
|
-
child = nil
|
|
20
17
|
begin
|
|
18
|
+
require_relative file
|
|
21
19
|
child = clas.split("::").inject(Object) do |m, c|
|
|
22
20
|
m.const_get(c)
|
|
23
|
-
end
|
|
21
|
+
end
|
|
22
|
+
children[clas] = child
|
|
24
23
|
rescue NameError
|
|
25
24
|
raise Error::UnknownChildClassError.new(clas)
|
|
26
25
|
end
|
|
27
|
-
children[clas] = child if (child)
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
|
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: 0.
|
|
4
|
+
version: 1.0.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: 2016-03
|
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
60
|
version: '0'
|
|
61
61
|
requirements: []
|
|
62
62
|
rubyforge_project:
|
|
63
|
-
rubygems_version: 2.5.1
|
|
63
|
+
rubygems_version: 2.4.5.1
|
|
64
64
|
signing_key:
|
|
65
65
|
specification_version: 4
|
|
66
66
|
summary: Dynamically load children classes
|