fagin 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fagin.rb +19 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec627f1c90e140159c4542b062be31ab8a8830cd717d8779713dec262232190
4
- data.tar.gz: ab6c12883739989c0be041efd35140aa9762d3bf1773414efee64a4299e7d16d
3
+ metadata.gz: 2eec106dd94688b510c32827ba3dcddc7f2bc341907e2889d2890071cb6b93db
4
+ data.tar.gz: e9f5210e8f58c05d164c28266089d97bb3209af669fea13dbe7baf85608119a5
5
5
  SHA512:
6
- metadata.gz: c8a714340c867111b18a04c7afc2ee8eef242f9a5d673d1ffc9c447e2922cec61355c74ddb5b56bcba612d1f09ea31b1f72d00e1331f1c5d1698e7445cc88881
7
- data.tar.gz: 30e35bf695755e4971778d285577ab7820787196d69d190907c916cdf02e37a08741e75bc0154d59981623d38f9ff90c13eb423e8b41647edffae171281538e1
6
+ metadata.gz: 4c2411155c4b8d9354c274a1f2401f90fa362273185366a55a69e874e30b74d54507c2c2168d584e8f6d4c904520e493350abaac2c7a765d9fa7d131c703a4f7
7
+ data.tar.gz: bd6c75e508d40e81189d3939d9fd4e877bf36162a24005238edce3728ed64e9ff9d2186c30325fdacbace71b33e485524af7691c9bb3ac440e2643b9f39bef1d
@@ -1,7 +1,12 @@
1
1
  require "pathname"
2
2
 
3
3
  class Fagin
4
- def self.find_children(parent, dir, recursive = false)
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
- children[clas] = child
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.1.3
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-04-14 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake