tarot 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tarot.rb +14 -2
- data/lib/tarot/version.rb +1 -1
- metadata +4 -4
data/lib/tarot.rb
CHANGED
@@ -26,11 +26,23 @@ module Tarot
|
|
26
26
|
@config_cache[env][key] ||= key.split('.').inject(@yaml[env || @env]) {|e, part| e.try(:[], part) } || default
|
27
27
|
end
|
28
28
|
|
29
|
+
def merge(hash, namespace = nil)
|
30
|
+
target = namespace.nil? ? @yaml[@env] : get(namespace)
|
31
|
+
add_mm hash
|
32
|
+
recursive_merge(target, hash)
|
33
|
+
@config_cache.clear
|
34
|
+
end
|
35
|
+
|
36
|
+
def merge_file(file, namespace = nil)
|
37
|
+
merge YAML::load(open(file).read).stringify_keys!, namespace
|
38
|
+
end
|
39
|
+
|
29
40
|
def with_environment(env)
|
41
|
+
env ||= self.env
|
30
42
|
old_env, self.env = self.env, env
|
31
|
-
yield if block_given?
|
43
|
+
result = yield if block_given?
|
32
44
|
self.env = old_env
|
33
|
-
|
45
|
+
result
|
34
46
|
end
|
35
47
|
|
36
48
|
private
|
data/lib/tarot/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tarot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Heald
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|