zfaker 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 791827cda577cc07822834d7c855f25b76b3bf88
4
- data.tar.gz: 7081a38021838e873e25ed95586057d7f4a2570c
3
+ metadata.gz: 1d8dedc809169825b0424e9ad025e5f885b6f3ad
4
+ data.tar.gz: 31f918722877acf12fcb7f84586212e4ada72cdc
5
5
  SHA512:
6
- metadata.gz: 038a633d64114abf2df5dc547ec90d913132bba3bb1e81d9a5dfb917fe04469088b42adf1531a416adc4b85618511f2fab2bf8bc843de7f9c7530c73e62b3e8f
7
- data.tar.gz: d5a170d6d358f8ba904c0d876c93d3d5757710a6ff77869dcf49789b8d1010fa2f327c6ea57023876bae933a2783b0077a16921c343c6ef21669dff841bfc6b3
6
+ metadata.gz: 143888d948e68ece661a20a87031849b9a2c278d63d47ced3ecac6be1d87d7393214cacc261489278c87fc3691e8597f2c258cd47afd2452959c7e7321b2537d
7
+ data.tar.gz: c98280852eff8f4c1694e7aa1499b37915e570246424609ac384fe3f34f8c80f9960f148f399dd4ea396fefc77f5908f77a8e79e772d68ae9b1b30477078e0fc
@@ -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
@@ -27,7 +27,7 @@ module ZFaker
27
27
  letterify(numerify(masks))
28
28
  end
29
29
 
30
- def add(file)
30
+ def self.add(file)
31
31
  extn = File.extname file
32
32
  name = File.basename file, extn
33
33
  build_const(name, file)
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/**/*.rb"].each do |file|
6
- ZFaker.add(file)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zfaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Mackie