bonfig 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/Rakefile +0 -3
- data/lib/bonfig.rb +11 -0
- data/lib/bonfig/version.rb +1 -1
- data/spec/bonfig_spec.rb +6 -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: a433047dde3bd86d6cb2f6238a1ea0a4e0fe921d
|
|
4
|
+
data.tar.gz: 832365d0c5bd33271e6856e1df874cd919a737d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 423f9230ddb0e2c11c411ab62e6973018171e65de8c4c646ac8d996647024701c2ebb59507605ad5b17ac1bf0ec9d9e058e2c4f1b04bc1302acc3acfb3d887b2
|
|
7
|
+
data.tar.gz: 20ea4e5e744fe585909def97e80706350e3b309bff167b142e37133be0d959cf930419ccb3eedad68fe5e7c02162d1916c1495f6dec2d00e47ea041616c248a4
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://codeclimate.com/github/GeorgeErickson/bonfig)
|
|
4
4
|
[](https://coveralls.io/r/GeorgeErickson/bonfig?branch=master)
|
|
5
5
|
[](https://gemnasium.com/GeorgeErickson/bonfig)
|
|
6
|
-
|
|
6
|
+
[](http://badge.fury.io/rb/bonfig)
|
|
7
7
|
|
|
8
8
|
Simple configuration for modules.
|
|
9
9
|
|
data/Rakefile
CHANGED
data/lib/bonfig.rb
CHANGED
|
@@ -22,6 +22,17 @@ module Bonfig
|
|
|
22
22
|
@_data[key]
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def to_hash
|
|
26
|
+
@_data.reduce({}) do |accum, (k, val)|
|
|
27
|
+
accum[k] = val.instance_of?(BlankConfig) ? val.to_hash : val
|
|
28
|
+
accum
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def instance_of?(klass)
|
|
33
|
+
klass == BlankConfig
|
|
34
|
+
end
|
|
35
|
+
|
|
25
36
|
protected
|
|
26
37
|
|
|
27
38
|
def _update(data)
|
data/lib/bonfig/version.rb
CHANGED
data/spec/bonfig_spec.rb
CHANGED
|
@@ -37,6 +37,11 @@ describe Bonfig do
|
|
|
37
37
|
|
|
38
38
|
expect(subject.config.name).to eq(1)
|
|
39
39
|
expect(subject.config.name_default).to eq(2)
|
|
40
|
+
expect(subject.config.to_hash).to eq(name: 1, name_default: 2)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'to_hash' do
|
|
44
|
+
expect(subject.config.to_hash).to eq(name: nil, name_default: 1)
|
|
40
45
|
end
|
|
41
46
|
end
|
|
42
47
|
|
|
@@ -67,9 +72,9 @@ describe Bonfig do
|
|
|
67
72
|
c.redis do |r|
|
|
68
73
|
r.port = 1
|
|
69
74
|
end
|
|
70
|
-
|
|
71
75
|
expect(subject.config.redis.port).to eq(1)
|
|
72
76
|
expect(subject.config.redis.host).to eq('localhost')
|
|
77
|
+
expect(subject.config.to_hash).to eq(redis: { port: 1, host: 'localhost' })
|
|
73
78
|
end
|
|
74
79
|
end
|
|
75
80
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bonfig
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- George Erickson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-03-
|
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|