zfaker 0.0.5 → 0.0.6
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/bin/utils/module_utils.rb +1 -26
- data/bin/zfaker.rb +1 -1
- data/lib/config.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8dedc809169825b0424e9ad025e5f885b6f3ad
|
4
|
+
data.tar.gz: 31f918722877acf12fcb7f84586212e4ada72cdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 143888d948e68ece661a20a87031849b9a2c278d63d47ced3ecac6be1d87d7393214cacc261489278c87fc3691e8597f2c258cd47afd2452959c7e7321b2537d
|
7
|
+
data.tar.gz: c98280852eff8f4c1694e7aa1499b37915e570246424609ac384fe3f34f8c80f9960f148f399dd4ea396fefc77f5908f77a8e79e772d68ae9b1b30477078e0fc
|
data/bin/utils/module_utils.rb
CHANGED
@@ -6,31 +6,6 @@ module ZFaker
|
|
6
6
|
def k(arg) ZFaker::ArrayUtils.const_array(arg)
|
7
7
|
end
|
8
8
|
|
9
|
-
def const_missing(const_name)
|
10
|
-
if const_name =~ /[a-z]/ # Not a constant, probably a class/module name.
|
11
|
-
super const_name
|
12
|
-
else
|
13
|
-
mod_name = ancestors.first.to_s.split('::').last
|
14
|
-
data_path = "#{ZFaker::BASE_LIB_PATH}/data/#{underscore(mod_name)}/#{underscore(const_name.to_s)}"
|
15
|
-
reader = k File.read(data_path).split("\n")
|
16
|
-
arrout = []
|
17
|
-
reader.each do |x|
|
18
|
-
cut = x.split(' ')
|
19
|
-
if cut.size > 1 && cut[0].integer?
|
20
|
-
weight = cut[0].to_i
|
21
|
-
element = cut[1..-1].join(' ')
|
22
|
-
element = '' if element == '<blank>'
|
23
|
-
else
|
24
|
-
weight = 1
|
25
|
-
element = cut[0..-1].join(' ')
|
26
|
-
end
|
27
|
-
weight.times { arrout.push(element) }
|
28
|
-
end
|
29
|
-
const_set const_name, arrout
|
30
|
-
arrout
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
9
|
def build_const(const_name, file)
|
35
10
|
data_path = file
|
36
11
|
reader = k File.read(data_path).split("\n")
|
@@ -47,7 +22,7 @@ module ZFaker
|
|
47
22
|
end
|
48
23
|
weight.times { arrout.push(element) }
|
49
24
|
end
|
50
|
-
const_set const_name, arrout
|
25
|
+
const_set const_name.upcase, arrout
|
51
26
|
arrout
|
52
27
|
end
|
53
28
|
|
data/bin/zfaker.rb
CHANGED
data/lib/config.rb
CHANGED
@@ -2,6 +2,10 @@ Dir["#{File.dirname(File.absolute_path(__FILE__))}/custom/**/*.rb"].each do |fil
|
|
2
2
|
require_relative file
|
3
3
|
end
|
4
4
|
|
5
|
-
Dir["#{File.dirname(File.absolute_path(__FILE__))}/data
|
6
|
-
|
5
|
+
Dir["#{File.dirname(File.absolute_path(__FILE__))}/data/*"].each do |folder|
|
6
|
+
if File.directory? folder
|
7
|
+
Dir["#{folder}/*"].each do |file|
|
8
|
+
ZFaker.add(file)
|
9
|
+
end
|
10
|
+
end
|
7
11
|
end
|