ultra_config 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ultra_config/config.rb +8 -1
- data/lib/ultra_config/namespace.rb +3 -3
- data/ultra_config.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa45a0f3ecf8a2044f7f1f57b610a4c147b0776
|
4
|
+
data.tar.gz: 4d5c393e0d79e7883ce03e0186d9a9ce23fda894
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 746e79bd77da3732f5ee3c60fcdb3b22cee05b9dadce62b7112e0af86d10c3854bcc560ef397a8f092ecdc90d7179ff2a0224895fcbad8855d470a91836be351
|
7
|
+
data.tar.gz: 40ed4c03ad3d9565e0764e14018198ca4c6389f1e33830af93e965e7864ee5647e7c25dada02a271f583807b55d5ad80c534991cd67a0a47232de1db758a5bd8
|
data/lib/ultra_config/config.rb
CHANGED
@@ -5,8 +5,11 @@ module UltraConfig
|
|
5
5
|
class Config
|
6
6
|
attr_reader :value
|
7
7
|
|
8
|
-
def initialize(default_value, &block)
|
8
|
+
def initialize(default_value, options = {}, &block)
|
9
9
|
@validation = block
|
10
|
+
|
11
|
+
@sanitize = options[:sanitize] || false
|
12
|
+
|
10
13
|
self.value=(default_value)
|
11
14
|
end
|
12
15
|
|
@@ -20,6 +23,10 @@ module UltraConfig
|
|
20
23
|
Validator.validate(@value, new_value, &@validation)
|
21
24
|
end
|
22
25
|
|
26
|
+
def sanitize?
|
27
|
+
@sanitize
|
28
|
+
end
|
29
|
+
|
23
30
|
def to_s
|
24
31
|
"\"#{@value.to_s}\""
|
25
32
|
end
|
@@ -20,8 +20,8 @@ module UltraConfig
|
|
20
20
|
@objects[name] = Namespace.new(&block)
|
21
21
|
end
|
22
22
|
|
23
|
-
def config(name, default = nil, &block)
|
24
|
-
@objects[name] = Config.new(default, &block)
|
23
|
+
def config(name, default = nil, options = {}, &block)
|
24
|
+
@objects[name] = Config.new(default, options, &block)
|
25
25
|
end
|
26
26
|
|
27
27
|
def helper(name, &block)
|
@@ -54,7 +54,7 @@ module UltraConfig
|
|
54
54
|
hash = {}
|
55
55
|
@objects.each do |name, object|
|
56
56
|
if object.is_a?(Config)
|
57
|
-
hash[name] = object.value
|
57
|
+
object.sanitize? ? hash[name] = '*****' : hash[name] = object.value
|
58
58
|
else
|
59
59
|
hash[name] = object.to_h
|
60
60
|
end
|
data/ultra_config.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Kuruc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|