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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef3922624fb3376ac07f3aa68273ba3832cb3ff2
4
- data.tar.gz: 4ff32e508b19c6d39795c11134752cccf6153165
3
+ metadata.gz: ffa45a0f3ecf8a2044f7f1f57b610a4c147b0776
4
+ data.tar.gz: 4d5c393e0d79e7883ce03e0186d9a9ce23fda894
5
5
  SHA512:
6
- metadata.gz: 452da79081a7f2b4e52c710857b575eb163c82720d4838455016786167a6918e345e72d22957223837a63ec485ead55054884d3960a2d05468731d3d858bedda
7
- data.tar.gz: c9c92dfc65e7da7a61edc8d64257448fde2b408d1904bf6f59558a6943fb667ff9b468a0a28dcdd1f38cb27c4abdba9b428d326f5077f4fe7ac2bca1388f3f58
6
+ metadata.gz: 746e79bd77da3732f5ee3c60fcdb3b22cee05b9dadce62b7112e0af86d10c3854bcc560ef397a8f092ecdc90d7179ff2a0224895fcbad8855d470a91836be351
7
+ data.tar.gz: 40ed4c03ad3d9565e0764e14018198ca4c6389f1e33830af93e965e7864ee5647e7c25dada02a271f583807b55d5ad80c534991cd67a0a47232de1db758a5bd8
@@ -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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'ultra_config'
7
- spec.version = '0.8.0'
7
+ spec.version = '0.9.0'
8
8
  spec.authors = ['Gregory Kuruc']
9
9
  spec.email = ['gjk910327@gmail.com']
10
10
 
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.8.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-19 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler