konfa 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/konfa.rb +12 -3
- metadata +2 -2
data/lib/konfa.rb
CHANGED
@@ -12,7 +12,11 @@ module Konfa
|
|
12
12
|
# they will then be public
|
13
13
|
#
|
14
14
|
|
15
|
-
attr_writer :configuration, :deferred
|
15
|
+
attr_writer :configuration, :deferred, :initialized_deferred
|
16
|
+
|
17
|
+
def initialized_deferred
|
18
|
+
@initialized_deferred ||= false
|
19
|
+
end
|
16
20
|
|
17
21
|
def configuration
|
18
22
|
@configuration ||= self.allowed_variables
|
@@ -37,7 +41,7 @@ module Konfa
|
|
37
41
|
|
38
42
|
def do_deferred_initialization
|
39
43
|
self.send(self.deferred.first, *self.deferred[1..-1])
|
40
|
-
self.
|
44
|
+
self.initialized_deferred = true
|
41
45
|
end
|
42
46
|
|
43
47
|
public
|
@@ -59,12 +63,16 @@ module Konfa
|
|
59
63
|
raise UnsupportedVariableError.new(key)
|
60
64
|
end
|
61
65
|
|
66
|
+
def do_deferred_initialization?
|
67
|
+
!self.initialized_deferred && !self.deferred.nil?
|
68
|
+
end
|
69
|
+
|
62
70
|
#
|
63
71
|
# The following methods provides the interface to this class
|
64
72
|
#
|
65
73
|
|
66
74
|
def get(variable)
|
67
|
-
self.do_deferred_initialization
|
75
|
+
self.do_deferred_initialization if self.do_deferred_initialization?
|
68
76
|
raise UnsupportedVariableError.new(variable) unless self.configuration.has_key? variable
|
69
77
|
self.configuration[variable]
|
70
78
|
end
|
@@ -135,6 +143,7 @@ module Konfa
|
|
135
143
|
|
136
144
|
self.store(variable, ENV[key])
|
137
145
|
}
|
146
|
+
|
138
147
|
after_initialize
|
139
148
|
dump
|
140
149
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konfa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Helps you avoid common pitfalls when dealing with app config
|
16
16
|
email: code@avidiy.se
|