farm_equipment 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/abbrv.rb +20 -0
- data/lib/farm_equipment/version.rb +1 -1
- metadata +2 -2
data/lib/abbrv.rb
CHANGED
@@ -50,6 +50,26 @@ module Abbrv
|
|
50
50
|
key_arr.uniq
|
51
51
|
end
|
52
52
|
|
53
|
+
def sub_hash(subkey)
|
54
|
+
ret_hash = {}
|
55
|
+
@seed_hash.each do |k,v|
|
56
|
+
ret_hash[k] = @seed_hash[k][subkey] if @seed_hash[k].has_key?(subkey)
|
57
|
+
end
|
58
|
+
ret_hash
|
59
|
+
end
|
60
|
+
|
61
|
+
def random_val(subkey)
|
62
|
+
#no spec. eyeball tested
|
63
|
+
vals = sub_hash(subkey).values
|
64
|
+
vals[rand(0..vals.count - 1)]
|
65
|
+
end
|
66
|
+
|
67
|
+
def random_main_key
|
68
|
+
#no spec. eyeball tested
|
69
|
+
keys = @seed_hash.keys
|
70
|
+
keys[rand(0..keys.count - 1)]
|
71
|
+
end
|
72
|
+
|
53
73
|
protected
|
54
74
|
|
55
75
|
def validate_for_value_uniqueness
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farm_equipment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|