ultra_config 0.9.1 → 0.10.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: d923904e21359dbeee843bde20f65baffb470190
4
- data.tar.gz: 69da171b1598677a0209e0b0e7bfb7641073a6fc
3
+ metadata.gz: 2ce95b60966551465286031c7252fb02681c8bdb
4
+ data.tar.gz: 7a4679adbb01cbeca22a67401c8899b780a28be0
5
5
  SHA512:
6
- metadata.gz: ce11dc29cbf49c94df57ba3a552d44d2dfe7233d66963778ac42d8a992eb932cfafd6de3bd432d9618755dc14be9ba0fffaf033e3d6be28cef8148efdbc9cbd8
7
- data.tar.gz: e98cc94d35466365c3d42221c9d32c9a894438aa2945668d174ad9deaf9b17bbdfd577c7be90137c2419492b562300ac9d10276e8c1d59ba7b7f0b3344cd45ce
6
+ metadata.gz: a23263c099c183c8549a5c8bff397abbb4fcb9add5e730804e424c0426b9e2c9e7fb5f8c45bf5572f47f82ee2661249afbff14cbb30dd9926d050bcaf8cf068e
7
+ data.tar.gz: 91ea6d74b8d32dacece74cfddb608bb6b8dff20bc01d50f0ef69b3397f1ab3f4b02708bb94367fba11168b6c7528f60fba95b14f13bfe412924e38cbeb9fadb4
@@ -4,6 +4,8 @@ module UltraConfig
4
4
  class Namespace
5
5
  class ObjectNotFoundError < StandardError; end
6
6
 
7
+ attr_reader :objects
8
+
7
9
  def initialize(&block)
8
10
  @configuration = [block]
9
11
  reset
@@ -38,16 +40,20 @@ module UltraConfig
38
40
  @configuration.each { |config| self.instance_eval(&config) }
39
41
  end
40
42
 
41
- def to_s
42
- objs = []
43
+ def to_h
44
+ hash = {}
45
+ @objects.each do |name, object|
46
+ if object.is_a?(Config)
47
+ hash[name] = object.value
48
+ else
49
+ hash[name] = object.to_h
50
+ end
51
+ end
43
52
 
44
- output = '{ '
45
- @objects.each { |name, object| objs << "#{name}: #{object.to_s}" }
46
- output << objs.join(', ')
47
- output << ' }'
53
+ hash
48
54
  end
49
55
 
50
- def to_h
56
+ def to_sanitized_h
51
57
  hash = {}
52
58
  @objects.each do |name, object|
53
59
  if object.is_a?(Config)
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.9.1'
7
+ spec.version = '0.10.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.9.1
4
+ version: 0.10.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-22 00:00:00.000000000 Z
11
+ date: 2018-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler