app_conf 0.2.3 → 0.2.4

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.
data/README.markdown CHANGED
@@ -2,6 +2,11 @@ AppConf
2
2
  =======
3
3
  Simplest YAML Backed Application Wide Configuration (AppConfig)
4
4
 
5
+ * Load from YAML file(s)
6
+ * Add additional key/value pairs in code
7
+ * Use dot or bracket notation
8
+ * `AppConf.to_hash` outputs a hash map of AppConf key/values
9
+
5
10
  Installation
6
11
  ----------------------------------
7
12
  gem install app_conf
data/app_conf.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'base64'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'app_conf'
5
- s.version = '0.2.3'
5
+ s.version = '0.2.4'
6
6
  s.authors = 'Phil Thompson'
7
7
  s.email = Base64.decode64("cGhpbEBlbGVjdHJpY3Zpc2lvbnMuY29t\n")
8
8
  s.summary = 'Simplest YAML Backed Application Wide Configuration (AppConfig)'
data/lib/app_conf.rb CHANGED
@@ -17,6 +17,16 @@ class AppConf
17
17
  nil
18
18
  end
19
19
 
20
+ def self.to_hash
21
+ @@root.to_hash
22
+ end
23
+
24
+ def to_hash
25
+ hash = {}
26
+ @hash.each {|k, v| hash[k] = v.is_a?(AppConf) ? v.to_hash : v }
27
+ hash
28
+ end
29
+
20
30
  def keys
21
31
  @hash.keys
22
32
  end
@@ -14,6 +14,13 @@ describe AppConf do
14
14
  AppConf.load("#{@dir}/config.yml")
15
15
  end
16
16
 
17
+ describe 'inspect' do
18
+ it 'outputs a tree hash' do
19
+ AppConf.load("#{@dir}/other.yml")
20
+ AppConf.to_hash.must_equal({'fullname' => 'Joe Bloggs', 'user' => {'name' => {'first' => 'Joe'}, 'address' => {'street' => '1 Some Road'}}})
21
+ end
22
+ end
23
+
17
24
  describe 'keys' do
18
25
  it 'returns them' do
19
26
  AppConf.from_hash(:users => {:joe => nil, :mark => nil})
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_conf
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 3
9
- version: 0.2.3
4
+ prerelease:
5
+ version: 0.2.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Phil Thompson
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-03-29 00:00:00 +01:00
13
+ date: 2011-05-07 00:00:00 +01:00
18
14
  default_executable:
19
15
  dependencies: []
20
16
 
@@ -50,23 +46,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
46
  requirements:
51
47
  - - ">="
52
48
  - !ruby/object:Gem::Version
53
- segments:
54
- - 0
55
49
  version: "0"
56
50
  required_rubygems_version: !ruby/object:Gem::Requirement
57
51
  none: false
58
52
  requirements:
59
53
  - - ">="
60
54
  - !ruby/object:Gem::Version
61
- segments:
62
- - 1
63
- - 3
64
- - 6
65
55
  version: 1.3.6
66
56
  requirements: []
67
57
 
68
58
  rubyforge_project:
69
- rubygems_version: 1.3.7
59
+ rubygems_version: 1.6.2
70
60
  signing_key:
71
61
  specification_version: 3
72
62
  summary: Simplest YAML Backed Application Wide Configuration (AppConfig)