fagin 1.1.0 → 1.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fagin.rb +26 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 341dd1040e22d1cd15e631a07e8a4d513ce9cacf337de9497e95d194cd6375b2
4
- data.tar.gz: 96ba74cbd13ee8248e3cadda9fe3aa3ea0bb904463f8f5b0968f9087ffc44f2c
3
+ metadata.gz: 2f1aca3358735598f0ab92cfd300cef33388cbfb270da2697793d89bbb85b4b7
4
+ data.tar.gz: f0e3dfd4ba73e37ff06399e43765dcdb2f23c401d8867e07ecc8705cc60bfca2
5
5
  SHA512:
6
- metadata.gz: 6d752c5e24b90cfeb21e1bf40f107612fd680ad6762363a7652b8542d054f132b145c3de685cdcaa3ff104f27b058842cf9490ab75467f1e2d4afafafede99ac
7
- data.tar.gz: '019a92d36b3d2f3d4284e7c7a876cf4baa30b8c0287716b0dbb09af5f28738cc13f944d8b6fc120c209c2ccc666f7db13b908843f0ee111073851b2edf332661'
6
+ metadata.gz: b4fa83afccb891d13ebe4050b8791bed7ef504b17e21353b780696f6830ac7501a1ea4e6b1028df4a84ef1c409747dad7a76301ad9c282f7a40acda16a2a781f
7
+ data.tar.gz: c2caf479c844d08978c5f04e4261c38665aecce5f65b89fdd863a189f0a0f1032aa9b617fb580adf2b083eaccc61ee11170662b68895d732aecc99d220fd61e9
data/lib/fagin.rb CHANGED
@@ -9,18 +9,20 @@ class Fagin
9
9
  %x(
10
10
  \grep -EHos "^class +.+ *< *#{parent}" #{path}/*.rb
11
11
  ).each_line do |line|
12
- clas = line.match(/class\s+(\S+)\s*</)[1]
13
- next if (clas.nil? || clas.empty?)
14
- file = line.match(/^([^:]+\.rb)/)[1]
15
- next if (file.nil? || file.empty?)
16
- begin
17
- require_relative file
18
- child = clas.split("::").inject(Object) do |m, c|
19
- m.const_get(c)
12
+ line.match(/^([^:]+\.rb).+class\s+(\S+)\s*</) do |match|
13
+ file = match[1]
14
+ next if (file.nil? || file.empty?)
15
+ clas = match[2]
16
+ next if (clas.nil? || clas.empty?)
17
+ begin
18
+ require_relative file
19
+ child = clas.split("::").inject(Object) do |m, c|
20
+ m.const_get(c)
21
+ end
22
+ children[clas] = child
23
+ rescue NameError
24
+ raise Error::UnknownChildClassError.new(clas)
20
25
  end
21
- children[clas] = child
22
- rescue NameError
23
- raise Error::UnknownChildClassError.new(clas)
24
26
  end
25
27
  end
26
28
 
@@ -35,18 +37,20 @@ class Fagin
35
37
  %x(
36
38
  \grep -EHors "^class +.+ *< *#{parent}" #{path}
37
39
  ).each_line do |line|
38
- clas = line.match(/class\s+(\S+)\s*</)[1]
39
- next if (clas.nil? || clas.empty?)
40
- file = line.match(/^([^:]+\.rb)/)[1]
41
- next if (file.nil? || file.empty?)
42
- begin
43
- require_relative file
44
- child = clas.split("::").inject(Object) do |m, c|
45
- m.const_get(c)
40
+ line.match(/^([^:]+\.rb).+class\s+(\S+)\s*</) do |match|
41
+ file = match[1]
42
+ next if (file.nil? || file.empty?)
43
+ clas = match[2]
44
+ next if (clas.nil? || clas.empty?)
45
+ begin
46
+ require_relative file
47
+ child = clas.split("::").inject(Object) do |m, c|
48
+ m.const_get(c)
49
+ end
50
+ children[clas] = child
51
+ rescue NameError
52
+ raise Error::UnknownChildClassError.new(clas)
46
53
  end
47
- children[clas] = child
48
- rescue NameError
49
- raise Error::UnknownChildClassError.new(clas)
50
54
  end
51
55
  end
52
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fagin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker