uber_config 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/uber_config.rb +24 -0
- data/lib/uber_config/version.rb +1 -1
- data/test/test_uber_config.rb +6 -0
- metadata +2 -2
data/lib/uber_config.rb
CHANGED
@@ -106,4 +106,28 @@ module UberConfig
|
|
106
106
|
end
|
107
107
|
hash
|
108
108
|
end
|
109
|
+
|
110
|
+
# Non destructive, returns new hash.
|
111
|
+
def self.symbolize_keys(hash)
|
112
|
+
keys = hash.keys
|
113
|
+
ret = {}
|
114
|
+
keys.each do |key|
|
115
|
+
v = hash[key]
|
116
|
+
if v.is_a?(Hash)
|
117
|
+
v = symbolize_keys(v)
|
118
|
+
end
|
119
|
+
ret[(key.to_sym rescue key) || key] = v
|
120
|
+
end
|
121
|
+
ret
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.make_indifferent(hash)
|
125
|
+
hash.default_proc = proc do |h, k|
|
126
|
+
case k
|
127
|
+
when String then sym = k.to_sym; h[sym] if h.key?(sym)
|
128
|
+
when Symbol then str = k.to_s; h[str] if h.key?(str)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
109
133
|
end
|
data/lib/uber_config/version.rb
CHANGED
data/test/test_uber_config.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uber_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2012-07-
|
12
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Loads configs from common locations.
|
15
15
|
email:
|