choices 0.2.1 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/choices.rb +14 -1
  2. metadata +3 -3
@@ -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
- YAML::load(yaml_content)[env]
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: 21
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Mislav Marohni\xC4\x87"