asetus 0.0.1 → 0.0.3

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: aabab562229de22b1301e26910b4a000a2086a15
4
- data.tar.gz: b7fd09d5490ff4a84a3659cc653c02c4a70910ad
3
+ metadata.gz: 4fabf93268fce1615b09c0169c1c7b7d580ba66f
4
+ data.tar.gz: c83d026f4830c955396495de0c5ff9bcb752a540
5
5
  SHA512:
6
- metadata.gz: cbc9b3ab70bd09b13c4d99ef328bebe75c2515b01f41c1074e5180f16878fc221db0e2bcb70f7aafa7d41fbfcbd1398383184954acf357e4932c4a38bb4684aa
7
- data.tar.gz: 79c8ece12fa2d9a32bb58a1e67ff7cbc7c838aff04355d661cb2220d6f29b7afe8c416ccc76dcf8bad8628e3c19f3cff5863df72ba870b4a62a54a02f9b55644
6
+ metadata.gz: a345a668e8a0362fcb38d1257f4f49243253401d0b3d66c3959cbdfc0ce3e4d6a90b39436378f1b640904f89ecdccd8043e93f2cc48f47f20ee1738a68717382
7
+ data.tar.gz: 1856d311d47d76a8eb739601d1181bb95b89a1aa68480c7eb0e0987e6d3db6715d872722df78f92ccb1f2f49abafa4936a86e4ab3d30258caa4716828278bf34
data/asetus.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'asetus'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.3'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = [ 'Saku Ytti' ]
6
6
  s.email = %w( saku@ytti.fi )
@@ -48,10 +48,11 @@ class Asetus
48
48
  cfg = {}
49
49
  hash.each do |key, value|
50
50
  if value.class == Hash
51
- value = _asetus_from_hash value
51
+ value = ConfigStruct.new value
52
52
  end
53
53
  cfg[key] = value
54
54
  end
55
+ cfg
55
56
  end
56
57
 
57
58
  end
data/lib/asetus.rb CHANGED
@@ -73,7 +73,7 @@ class Asetus
73
73
  def merge *configs
74
74
  hash = {}
75
75
  configs.each do |config|
76
- hash = hash.merge config._asetus_to_hash
76
+ hash = hash._asetus_deep_merge config._asetus_to_hash
77
77
  end
78
78
  ConfigStruct.new hash
79
79
  end
@@ -95,3 +95,12 @@ class Asetus
95
95
  raise NoName, "can't figure out name, specify explicitly"
96
96
  end
97
97
  end
98
+
99
+ class Hash
100
+ def _asetus_deep_merge newhash
101
+ merger = proc do |key, oldval, newval|
102
+ Hash === oldval && Hash === newval ? oldval.merge(newval, &merger) : newval
103
+ end
104
+ merge newhash, &merger
105
+ end
106
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asetus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-29 00:00:00.000000000 Z
11
+ date: 2014-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop