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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82a4327981273baf0b07451807a518228c777d66
4
- data.tar.gz: e6dceeb25502fb6896231a048601955e0c1a7c71
3
+ metadata.gz: a433047dde3bd86d6cb2f6238a1ea0a4e0fe921d
4
+ data.tar.gz: 832365d0c5bd33271e6856e1df874cd919a737d4
5
5
  SHA512:
6
- metadata.gz: b22c5f6a661b35ad0f28ff7e63c5e7580b6d8964b23ae1493cc703f836c7f343270da6a7b16c8d6f4de7216b3ef91f723d6a5723342b5e828210c3cbf00371e4
7
- data.tar.gz: 40f695e8f4b8c6ed6edf4872ab7fbbc5a281c74713fd992e2a14ad1ce5ffcfd9f991fee199d80211cd91d826c87d88fc9b5739ea2d2037549fb1f9883f92847e
6
+ metadata.gz: 423f9230ddb0e2c11c411ab62e6973018171e65de8c4c646ac8d996647024701c2ebb59507605ad5b17ac1bf0ec9d9e058e2c4f1b04bc1302acc3acfb3d887b2
7
+ data.tar.gz: 20ea4e5e744fe585909def97e80706350e3b309bff167b142e37133be0d959cf930419ccb3eedad68fe5e7c02162d1916c1495f6dec2d00e47ea041616c248a4
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg/
4
4
  coverage/
5
5
  vendor/cache/*.gem
6
6
  .bundle/
7
+ .DS_Store
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Code Climate](https://codeclimate.com/github/GeorgeErickson/bonfig.png)](https://codeclimate.com/github/GeorgeErickson/bonfig)
4
4
  [![Coverage Status](https://coveralls.io/repos/GeorgeErickson/bonfig/badge.png?branch=master)](https://coveralls.io/r/GeorgeErickson/bonfig?branch=master)
5
5
  [![Dependency Status](https://gemnasium.com/GeorgeErickson/bonfig.png)](https://gemnasium.com/GeorgeErickson/bonfig)
6
-
6
+ [![Gem Version](https://badge.fury.io/rb/bonfig.png)](http://badge.fury.io/rb/bonfig)
7
7
 
8
8
  Simple configuration for modules.
9
9
 
data/Rakefile CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rubygems'
4
4
 
5
-
6
5
  require 'rake'
7
6
 
8
7
  require 'rspec/core/rake_task'
@@ -10,5 +9,3 @@ RSpec::Core::RakeTask.new
10
9
 
11
10
  task test: :spec
12
11
  task default: :spec
13
-
14
-
@@ -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)
@@ -1,4 +1,4 @@
1
1
  module Bonfig
2
2
  # bonfig version
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
@@ -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.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-03 00:00:00.000000000 Z
11
+ date: 2014-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler