choices 0.2.1 → 0.2.4
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.
- data/lib/choices.rb +14 -1
- metadata +3 -3
data/lib/choices.rb
CHANGED
@@ -16,7 +16,7 @@ module Choices
|
|
16
16
|
|
17
17
|
def load_settings_hash(filename, env)
|
18
18
|
yaml_content = ERB.new(IO.read(filename)).result
|
19
|
-
|
19
|
+
yaml_load(yaml_content)[env]
|
20
20
|
end
|
21
21
|
|
22
22
|
def with_local_settings(filename, env, suffix)
|
@@ -26,6 +26,19 @@ module Choices
|
|
26
26
|
yield hash if hash
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
def yaml_load(content)
|
31
|
+
if defined? YAML::ENGINE
|
32
|
+
# avoid using broken Psych in 1.9.2
|
33
|
+
old_yamler = YAML::ENGINE.yamler
|
34
|
+
YAML::ENGINE.yamler = 'syck'
|
35
|
+
end
|
36
|
+
begin
|
37
|
+
YAML::load(content)
|
38
|
+
ensure
|
39
|
+
YAML::ENGINE.yamler = old_yamler if defined? YAML::ENGINE
|
40
|
+
end
|
41
|
+
end
|
29
42
|
end
|
30
43
|
|
31
44
|
if defined? Rails
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: choices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Mislav Marohni\xC4\x87"
|