configr 0.2.0 → 0.8.0

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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/*
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Josh Nesbitt <josh@josh-nesbitt.net>
1
+ Copyright (c) 2010 Josh Nesbitt <josh@josh-nesbitt.net>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -5,8 +5,8 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "configr"
8
- gem.summary = "A more Rubyish approach to creating and accessing configuration values."
9
- gem.description = "Configr aims to provide a more Ruby-like interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash. "
8
+ gem.summary = "A more elegant approach to creating and accessing configuration values."
9
+ gem.description = "Configr aims to provide a clean interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash. "
10
10
  gem.email = "josh@josh-nesbitt.net"
11
11
  gem.homepage = "http://github.com/joshnesbitt/configr"
12
12
  gem.authors = ["Josh Nesbitt"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.8.0
data/configr.gemspec ADDED
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{configr}
8
+ s.version = "0.8.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Josh Nesbitt"]
12
+ s.date = %q{2010-02-26}
13
+ s.description = %q{Configr aims to provide a clean interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash. }
14
+ s.email = %q{josh@josh-nesbitt.net}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "LICENSE",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "configr.gemspec",
24
+ "examples/all.rb",
25
+ "lib/configr.rb",
26
+ "lib/configr/configuration.rb",
27
+ "lib/configr/configuration_block.rb",
28
+ "lib/configr/errors.rb",
29
+ "lib/configr/hash.rb",
30
+ "readme.rdoc",
31
+ "spec/fixtures/configuration.yml",
32
+ "spec/lib/configuration_block_spec.rb",
33
+ "spec/lib/configuration_spec.rb",
34
+ "spec/lib/errors_spec.rb",
35
+ "spec/lib/hash_spec.rb",
36
+ "spec/spec_helper.rb",
37
+ "spec/watch.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/joshnesbitt/configr}
40
+ s.rdoc_options = ["--charset=UTF-8"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.3.5}
43
+ s.summary = %q{A more elegant approach to creating and accessing configuration values.}
44
+ s.test_files = [
45
+ "spec/lib/configuration_block_spec.rb",
46
+ "spec/lib/configuration_spec.rb",
47
+ "spec/lib/errors_spec.rb",
48
+ "spec/lib/hash_spec.rb",
49
+ "spec/spec_helper.rb",
50
+ "spec/watch.rb",
51
+ "examples/all.rb"
52
+ ]
53
+
54
+ if s.respond_to? :specification_version then
55
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
+ s.specification_version = 3
57
+
58
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
59
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
60
+ else
61
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
62
+ end
63
+ else
64
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
65
+ end
66
+ end
67
+
data/examples/all.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'configr'))
2
2
 
3
+
3
4
  # Standalone (without YAML)
4
5
 
5
6
  configuration = Configr::Configuration.configure do |config|
@@ -54,20 +55,21 @@ puts configuration.example_two
54
55
  puts configuration.example_three
55
56
  puts configuration.example_four
56
57
 
57
- # Good for things like this
58
+ # Example of real world usage
58
59
 
59
- Config = Configr::Configuration.configure do |config|
60
- config.support_email = "goaway@example.com"
61
- config.google_analytics = "UA-x343x-SDS"
60
+ Configuration = Configr::Configuration.configure do |config|
61
+ config.email.from_address = "goaway@example.com"
62
+ config.email.from_name = "Someone"
62
63
 
63
64
  config.twitter.screen_name = "someone"
64
65
  config.twitter.password = "somepass"
66
+
67
+ config.wiki_url = "wiki.example.com"
65
68
  end
66
69
 
67
- puts Config.support_email
68
- puts Config.google_analytics
69
- puts Config.twitter[:screen_name]
70
- puts Config.twitter[:password]
70
+ puts Configuration.wiki_url
71
+ puts Configuration.twitter[:screen_name]
72
+ puts Configuration.twitter[:password]
71
73
 
72
- puts Config.twitter.screen_name
73
- puts Config.twitter.password
74
+ puts Configuration.email.from_address
75
+ puts Configuration.email.from_name
@@ -5,6 +5,21 @@ require 'configuration_block'
5
5
 
6
6
  module Configr
7
7
  class Configuration
8
+
9
+ class << self
10
+ def configure(yaml=nil)
11
+ instance = self.new(yaml)
12
+
13
+ yield instance.base if block_given?
14
+
15
+ instance.attributes = instance.base.attributes
16
+ instance.merge_configurations!
17
+ instance.attributes.recursive_normalize!
18
+
19
+ instance
20
+ end
21
+ end
22
+
8
23
  attr_accessor :base, :attributes, :yaml
9
24
 
10
25
  def initialize(yaml=nil)
@@ -12,20 +27,6 @@ module Configr
12
27
  self.yaml = yaml
13
28
  end
14
29
 
15
- def self.configure(yaml=nil)
16
- instance = self.new(yaml)
17
-
18
- yield instance.base if block_given?
19
-
20
- instance.attributes = instance.base.attributes
21
-
22
- instance.merge_configurations!
23
-
24
- instance.attributes.recursive_normalize!
25
-
26
- instance
27
- end
28
-
29
30
  def [](value)
30
31
  self.attributes[value]
31
32
  end
@@ -35,7 +36,7 @@ module Configr
35
36
 
36
37
  case
37
38
  when name.include?("=")
38
- raise ConfigurationLocked, "Blocked from configuring values after configuration has been run."
39
+ raise ConfigurationLocked, "Configuration is locked from configuring values after the configuration has been run."
39
40
  when name.include?("?")
40
41
  !self.attributes[name.gsub("?", "").to_sym].nil?
41
42
  else
@@ -46,12 +47,16 @@ module Configr
46
47
  def merge_configurations!
47
48
  return unless self.yaml
48
49
 
50
+ self.yaml = self.yaml.to_s
51
+
49
52
  hash = if File.exists?(self.yaml)
50
53
  YAML.load_file(self.yaml)
51
54
  else
52
55
  YAML.load(self.yaml)
53
56
  end
54
57
 
58
+ return unless hash
59
+
55
60
  hash = Hash.new(hash)
56
61
  hash.recursive_symbolize_keys!
57
62
 
@@ -1,7 +1,7 @@
1
1
  module Configr
2
2
  class ConfigurationBlock
3
3
  attr_accessor :attributes
4
-
4
+
5
5
  def initialize(attributes={})
6
6
  self.attributes = Hash.new(attributes)
7
7
  end
data/lib/configr/hash.rb CHANGED
@@ -1,15 +1,16 @@
1
1
  module Configr
2
2
  module HashExtensions
3
3
  def symbolize_keys!
4
- self.each { |k, v|
5
- self.delete(k.to_s);
4
+ each do |k, v|
5
+ self.delete(k.to_s)
6
6
  self[k.to_sym] = v
7
- }
7
+ end
8
8
  end
9
9
 
10
10
  def recursive_symbolize_keys!
11
- self.symbolize_keys!
12
- self.values.select{ |value|
11
+ symbolize_keys!
12
+
13
+ values.select { |value|
13
14
  value.is_a?(::Hash) || value.is_a?(Hash)
14
15
  }.each{ |hash|
15
16
  hash.recursive_symbolize_keys!
data/readme.rdoc CHANGED
@@ -4,17 +4,24 @@
4
4
  * Installation
5
5
  * Usage
6
6
  * Usage (within frameworks)
7
+ * Locking
8
+ * Bugs
7
9
  * Contributors
8
10
 
11
+
9
12
  == Overview
10
13
 
11
14
  Configr aims to provide a more Ruby-like interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash.
12
15
 
16
+
17
+
13
18
  == Installation
14
19
 
15
20
  The project is hosted on rubygems.org. Getting it is simple:
16
21
 
17
- gem install <gem name>
22
+ gem install configr
23
+
24
+
18
25
 
19
26
  == Usage
20
27
 
@@ -23,10 +30,11 @@ There are a variety of ways in which you can use Configr:
23
30
  * Standalone block
24
31
  * From inline YAML
25
32
  * From a YAML file
26
- * A mixture of YAML and block configuration
33
+ * A mixture of a YAML and block configuration
27
34
 
28
35
  The following examples can also be found and run in examples/all.rb.
29
36
 
37
+
30
38
  === Standalone Block
31
39
 
32
40
  configuration = Configr::Configuration.configure do |config|
@@ -37,7 +45,7 @@ The following examples can also be found and run in examples/all.rb.
37
45
  puts configuration.example_one
38
46
  puts configuration.example_two
39
47
 
40
- Conceptually you could continue to nest configuration blocks as far as you wish. They exist to enable you to seperate your configuration values into contexts. Take for example a set of email configuration values:
48
+ Conceptually you could continue to nest configuration blocks as far as you wish. They exist to enable you to separate your configuration values into contexts. Take for example a set of email configuration values:
41
49
 
42
50
  Configr::Configuration.configure do |config|
43
51
  config.email.from_address = "hello@example.com"
@@ -45,6 +53,10 @@ Conceptually you could continue to nest configuration blocks as far as you wish.
45
53
  config.email.reply_address = "reply@example.com"
46
54
  end
47
55
 
56
+ puts configuration.email.from_address
57
+ puts configuration.email.from_name
58
+ puts configuration.email.reply_address
59
+
48
60
  === From an inline YAML string
49
61
 
50
62
  yaml = <<YAML
@@ -59,6 +71,7 @@ Conceptually you could continue to nest configuration blocks as far as you wish.
59
71
  puts configuration.example_one
60
72
  puts configuration.example_two
61
73
 
74
+
62
75
  === From a YAML file
63
76
 
64
77
  configuration = Configr::Configuration.configure("/path/to/file.yml")
@@ -66,35 +79,41 @@ Conceptually you could continue to nest configuration blocks as far as you wish.
66
79
  puts configuration.value_one
67
80
  puts configuration.value_two
68
81
 
82
+
69
83
  === A mixture of any of the above
70
84
 
71
85
  yaml = <<YAML
72
86
 
73
- example_three: "Oooooo"
74
- example_four: "It loads from YAML too!"
75
-
87
+ example_three: "three"
88
+ example_four: "four"
89
+
76
90
  YAML
77
91
 
78
92
  configuration = Configr::Configuration.configure(yaml) do |config|
79
- config.example_one = "One"
80
- config.example_two = "Two"
93
+ config.example_one = "one"
94
+ config.example_two = "two"
81
95
  end
82
-
96
+
83
97
  puts configuration.example_one
84
98
  puts configuration.example_two
85
99
  puts configuration.example_three
86
100
  puts configuration.example_four
87
101
 
102
+
103
+
88
104
  == Usage (within frameworks)
89
105
 
90
- Configr is intended to be framework agnostic, but it's easy to get it going within Rails/Sinatra/Hot New Framework app.
106
+ Configr is intended to be framework agnostic, but it's easy to get it going inside of Rails/Sinatra/Hot New Framework.
107
+
91
108
 
92
109
  === Rails
93
110
 
94
- You can use Configr within Rails quite easily. I don't really plan to provide any "out of the box" way to hook Configr into Rails but it's quite easy to implement:
111
+ You can use Configr within Rails quite easily. I don't plan to provide any "out of the box" way to hook Configr into Rails but it's quite easy to implement:
95
112
 
96
113
  # In config/configuration.rb
97
- Config = Configr::Configuration.configure(Rails.root.join("config", "environments", "#{Rails.env}.yml")) do |config|
114
+ yaml_file = Rails.root.join("config", "environments", "#{Rails.env}.yml")
115
+
116
+ Configuration = Configr::Configuration.configure(yaml_file) do |config|
98
117
  config.my.configuration.value = "value"
99
118
  end
100
119
 
@@ -102,26 +121,43 @@ You can use Configr within Rails quite easily. I don't really plan to provide an
102
121
  require Rails.root.join("config", "configuration.rb")
103
122
 
104
123
  # Anywhere in your Rails app
105
- Config.my.configuration.value
124
+ Configuration.my.configuration.value
106
125
 
107
126
  By requiring a different YAML file based on the environment it is easy to override global values with environment specific values.
108
127
 
128
+
109
129
  === Sinatra
110
130
 
111
131
  A quick and dirty solution would be to pop it in a configure block:
112
132
 
113
133
  configure do
114
- Config = Configr::Configuration.configure(File.join("#{environment}.yml")) do |config|
134
+ Configuration = Configr::Configuration.configure("config/file.yml") do |config|
115
135
  config.something = "value"
116
136
  end
117
137
  end
118
138
 
119
139
  Again, by requiring a different YAML file based on the environment it is easy to override global values with environment specific values.
120
140
 
141
+
142
+
143
+ == A note about locking
144
+
145
+ By design a configuration value is not meant to be edited or created after the configuration block has been run (if you do you will run into a Configr::ConfigurationLocked error when assigning a value on the top level). In my opinion configurations such as those created in Configr are meant to be read-only during the lifetime of the application. Configr could however be altered to allow this with a patch should it be required.
146
+
147
+
148
+
149
+ == Bugs
150
+
151
+ If you have any problems with Configr, please file an issue at http://github.com/joshnesbitt/configr/issues.
152
+
153
+
154
+
121
155
  == Contributors
122
156
 
123
157
  * Thomas Williams for the concept of nested configuration blocks.
124
158
 
159
+
160
+
125
161
  == Note on Patches/Pull Requests
126
162
 
127
163
  * Fork the project.
@@ -132,6 +168,8 @@ Again, by requiring a different YAML file based on the environment it is easy to
132
168
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
133
169
  * Send me a pull request. Bonus points for topic branches.
134
170
 
171
+
172
+
135
173
  == Copyright
136
174
 
137
175
  Copyright (c) 2010 Josh Nesbitt <josh@josh-nesbitt.net>. See LICENSE for details.
@@ -1,5 +1,6 @@
1
1
  module Configr
2
2
  describe ConfigurationBlock do
3
+
3
4
  before do
4
5
  @hash = { :one => "one", :two => "two" }
5
6
  @block = ConfigurationBlock.new(@hash)
@@ -48,5 +49,6 @@ module Configr
48
49
  @block.five.six.class.should == ConfigurationBlock
49
50
  @block.five.six.seven.class.should == ConfigurationBlock
50
51
  end
52
+
51
53
  end
52
54
  end
@@ -1,110 +1,114 @@
1
1
  module Configr
2
2
  describe Configuration do
3
-
3
+
4
4
  it "should have the #configure class method to instantiate the configuration" do
5
5
  Configuration.should respond_to(:configure)
6
6
  end
7
-
7
+
8
8
  it "should return nil when a value is not set" do
9
9
  configuration = Configuration.configure do |config|
10
10
  config.key = "value"
11
11
  end
12
-
12
+
13
13
  configuration.other_key.should be_nil
14
14
  end
15
-
16
- it "should return a value for a key when one has been set" do
15
+
16
+ it "should return a value for a key thats been set" do
17
17
  configuration = Configuration.configure do |config|
18
18
  config.key = "value"
19
19
  end
20
-
20
+
21
21
  configuration.key.should == "value"
22
22
  end
23
-
24
- it "should raise an error when an existing value attempts to be updated" do
23
+
24
+ it "should return true on a value being present when using the #method?" do
25
25
  configuration = Configuration.configure do |config|
26
26
  config.key = "value"
27
27
  end
28
-
29
- lambda { configuration.key = "othervalue" }.should raise_error(Configr::ConfigurationLocked)
28
+
29
+ configuration.key?.should == true
30
+ configuration.other_value?.should == false
30
31
  end
31
-
32
- it "should report a value being present on #attribute?" do
32
+
33
+ it "should raise an error when an existing value attempts to be updated once configuration has been run" do
33
34
  configuration = Configuration.configure do |config|
34
35
  config.key = "value"
35
36
  end
36
-
37
- configuration.key?.should == true
38
- configuration.other_value?.should == false
37
+
38
+ lambda { configuration.key = "othervalue" }.should raise_error(Configr::ConfigurationLocked)
39
39
  end
40
-
41
- it "should load a configuration from a YAML string" do
40
+
41
+ it "should load a configuration hash from a YAML string" do
42
42
  yaml = <<-YAML
43
43
  first_name: Josh
44
44
  location: Leeds
45
45
  YAML
46
-
46
+
47
47
  configuration = Configuration.configure(yaml)
48
-
48
+
49
49
  configuration.first_name.should == "Josh"
50
50
  configuration.location.should == "Leeds"
51
51
  end
52
-
53
- it "should load a configuration from a YAML string and a block" do
52
+
53
+ it "should load a configuration hash from a YAML string and a block" do
54
54
  yaml = <<-YAML
55
55
  first_name: Josh
56
56
  location: Leeds
57
57
  YAML
58
-
58
+
59
59
  configuration = Configuration.configure(yaml) do |config|
60
60
  config.from_block = "value"
61
61
  end
62
-
62
+
63
63
  configuration.first_name.should == "Josh"
64
64
  configuration.location.should == "Leeds"
65
65
  configuration.from_block.should == "value"
66
66
  end
67
-
68
- it "should load a configation from a YAML file" do
67
+
68
+ it "should load a configation hash from a YAML file" do
69
69
  file = File.expand_path(File.join('spec', 'fixtures', 'configuration.yml'))
70
-
70
+
71
71
  configuration = Configuration.configure(file)
72
-
72
+
73
73
  configuration.first_name.should == "Bob"
74
74
  configuration.location.should == "Somewhere else"
75
75
  end
76
-
77
- it "should load a configation from a YAML file and a block" do
76
+
77
+ it "should load a configation hash from a YAML file and a block" do
78
78
  file = File.expand_path(File.join('spec', 'fixtures', 'configuration.yml'))
79
-
79
+
80
80
  configuration = Configuration.configure(file) do |config|
81
81
  config.hello = "value"
82
82
  end
83
-
83
+
84
84
  configuration.first_name.should == "Bob"
85
85
  configuration.location.should == "Somewhere else"
86
86
  configuration.hello.should == "value"
87
87
  end
88
-
89
- it "should allow a value from YAML to have precedence over the block" do
88
+
89
+ it "should allow a value from YAML to have precedence over the block value" do
90
90
  file = File.expand_path(File.join('spec', 'fixtures', 'configuration.yml'))
91
-
91
+
92
92
  configuration = Configuration.configure(file) do |config|
93
93
  config.first_name = "Billy"
94
94
  end
95
-
95
+
96
96
  configuration.first_name.should == "Bob"
97
97
  end
98
98
 
99
- it "should allow a deeply nested hash to be accessed with hash notation" do
99
+ it "should allow more than one value to be assigned within the same namespace" do
100
100
  configuration = Configuration.configure do |config|
101
- config.one.two.three.four = "value"
101
+ config.one.two.variable_one = "value one"
102
+ config.one.two.variable_two = "value two"
103
+ config.one.two.variable_three = "value three"
102
104
  end
103
105
 
104
- configuration.one[:two][:three][:four].should == "value"
106
+ configuration.one[:two][:variable_one].should == "value one"
107
+ configuration.one[:two][:variable_two].should == "value two"
108
+ configuration.one[:two][:variable_three].should == "value three"
105
109
  end
106
110
 
107
- it "should allow more than one value to be assigned within the same namespace" do
111
+ it "should allow standard hash based access to attributes" do
108
112
  configuration = Configuration.configure do |config|
109
113
  config.one.two.three.var1 = "value one"
110
114
  config.one.two.three.var2 = "value two"
@@ -116,12 +120,17 @@ module Configr
116
120
  configuration.one[:two][:three][:var3].should == "value three"
117
121
  end
118
122
 
119
- it "should allow method like lookup of attributes" do
123
+ it "should allow method based access to attributes" do
120
124
  configuration = Configuration.configure do |config|
121
- config.one.two.three.var1 = "value"
125
+ config.one.two.three.var1 = "value one"
126
+ config.one.two.three.var2 = "value two"
127
+ config.one.two.three.var3 = "value three"
122
128
  end
123
129
 
124
- configuration.one.two.three.var1.should == "value"
130
+ configuration.one.two.three.var1.should == "value one"
131
+ configuration.one.two.three.var2.should == "value two"
132
+ configuration.one.two.three.var3.should == "value three"
125
133
  end
134
+
126
135
  end
127
136
  end
@@ -1,12 +1,11 @@
1
1
  module Configr
2
2
  describe Hash do
3
3
 
4
- it "should have a base error class defined for Configr" do
5
- Configr::ConfigrError.ancestors.should include(StandardError)
6
-
4
+ it "should have a base error class" do
7
5
  error = Configr::ConfigrError.new("Error data")
8
6
 
9
7
  error.data.should == "Error data"
8
+ Configr::ConfigrError.ancestors.should include(StandardError)
10
9
  end
11
10
 
12
11
  end
@@ -1,7 +1,7 @@
1
1
  module Configr
2
2
  describe Hash do
3
3
 
4
- it "should create a ConfigurableHash from an existing hash" do
4
+ it "should create a Configr Hash from an existing hash" do
5
5
  hash = Hash.new({ :one => "one", :two => "two" })
6
6
 
7
7
  hash[:one].should == "one"
@@ -11,11 +11,17 @@ module Configr
11
11
  it "should symbolize a set of string keys" do
12
12
  hash = Hash.new({ "one" => "one", "two" => "two" })
13
13
 
14
+ hash["one"].should == "one"
15
+ hash["two"].should == "two"
16
+
14
17
  hash[:one].should be_nil
15
18
  hash[:two].should be_nil
16
19
 
17
20
  hash.symbolize_keys!
18
21
 
22
+ hash["one"].should be_nil
23
+ hash["two"].should be_nil
24
+
19
25
  hash[:one].should == "one"
20
26
  hash[:two].should == "two"
21
27
  end
@@ -23,12 +29,20 @@ module Configr
23
29
  it "should recursively symbolize a set of string keys" do
24
30
  hash = Hash.new({ "one" => "one", "two" => "two", "three" => { "four" => "four" } })
25
31
 
32
+ hash["one"].should == "one"
33
+ hash["two"].should == "two"
34
+ hash["three"]["four"].should == "four"
35
+
26
36
  hash[:one].should be_nil
27
37
  hash[:two].should be_nil
28
38
  hash[:three].should be_nil
29
39
 
30
40
  hash.recursive_symbolize_keys!
31
41
 
42
+ hash["one"].should be_nil
43
+ hash["two"].should be_nil
44
+ hash["three"].should be_nil
45
+
32
46
  hash[:one].should == "one"
33
47
  hash[:two].should == "two"
34
48
  hash[:three][:four].should == "four"
@@ -56,11 +70,12 @@ module Configr
56
70
  hash[:three][:five].class.should == Configr::Hash
57
71
  end
58
72
 
59
- it "should utilise method missing to provide access to hash keys" do
73
+ it "should allow method based access to hash keys" do
60
74
  hash = Hash.new({ :one => "one", :two => "two" })
61
75
 
62
76
  hash.one.should == "one"
63
77
  hash.two.should == "two"
64
78
  end
79
+
65
80
  end
66
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nesbitt
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.2.9
24
24
  version:
25
- description: "Configr aims to provide a more Ruby-like interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash. "
25
+ description: "Configr aims to provide a clean interface to configuring and reading a set of configuration values. The idea evolved from using a standard hash as a configuration store into a more elegant way to declare and read values from within a hash. "
26
26
  email: josh@josh-nesbitt.net
27
27
  executables: []
28
28
 
@@ -31,9 +31,11 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - LICENSE
33
33
  files:
34
+ - .gitignore
34
35
  - LICENSE
35
36
  - Rakefile
36
37
  - VERSION
38
+ - configr.gemspec
37
39
  - examples/all.rb
38
40
  - lib/configr.rb
39
41
  - lib/configr/configuration.rb
@@ -75,7 +77,7 @@ rubyforge_project:
75
77
  rubygems_version: 1.3.5
76
78
  signing_key:
77
79
  specification_version: 3
78
- summary: A more Rubyish approach to creating and accessing configuration values.
80
+ summary: A more elegant approach to creating and accessing configuration values.
79
81
  test_files:
80
82
  - spec/lib/configuration_block_spec.rb
81
83
  - spec/lib/configuration_spec.rb