conf 0.0.1 → 0.0.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.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/conf.gemspec +58 -0
  3. data/lib/conf.rb +4 -0
  4. data/spec/conf_spec.rb +6 -0
  5. metadata +3 -7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/conf.gemspec ADDED
@@ -0,0 +1,58 @@
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{conf}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jari Bakken"]
12
+ s.date = %q{2010-08-27}
13
+ s.description = %q{Simple configuraton library that supports inheritance.}
14
+ s.email = %q{jari.bakken@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "conf.gemspec",
27
+ "lib/conf.rb",
28
+ "spec/conf_spec.rb",
29
+ "spec/spec.opts",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/jarib/conf}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.7}
36
+ s.summary = %q{Simple configuraton library that supports inheritance.}
37
+ s.test_files = [
38
+ "spec/conf_spec.rb",
39
+ "spec/spec_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
48
+ s.add_development_dependency(%q<yard>, [">= 0"])
49
+ else
50
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
51
+ s.add_dependency(%q<yard>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
55
+ s.add_dependency(%q<yard>, [">= 0"])
56
+ end
57
+ end
58
+
data/lib/conf.rb CHANGED
@@ -39,6 +39,10 @@ class Conf
39
39
  @current_nesting = []
40
40
  end
41
41
 
42
+ def key?(key)
43
+ @data.key?(key) || (@parent && @parent.key?(key))
44
+ end
45
+
42
46
  def freeze
43
47
  @parent && @parent.freeze
44
48
  super
data/spec/conf_spec.rb CHANGED
@@ -91,4 +91,10 @@ describe "Conf" do
91
91
  conf = Conf.define(:tmp) { foo.bar.baz false }
92
92
  lambda { conf.bar }.should raise_error(Conf::InvalidKeyError)
93
93
  end
94
+
95
+ it "can check if a key exists" do
96
+ conf = Conf.define(:tmp) { foo.bar.baz false }
97
+ conf.key?("foo.bar.baz").should be_true
98
+ conf.key?("bar").should be_false
99
+ end
94
100
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 1
10
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jari Bakken
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 13
30
28
  segments:
31
29
  - 1
32
30
  - 2
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 3
46
43
  segments:
47
44
  - 0
48
45
  version: "0"
@@ -64,6 +61,7 @@ files:
64
61
  - README.rdoc
65
62
  - Rakefile
66
63
  - VERSION
64
+ - conf.gemspec
67
65
  - lib/conf.rb
68
66
  - spec/conf_spec.rb
69
67
  - spec/spec.opts
@@ -82,7 +80,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
80
  requirements:
83
81
  - - ">="
84
82
  - !ruby/object:Gem::Version
85
- hash: 3
86
83
  segments:
87
84
  - 0
88
85
  version: "0"
@@ -91,7 +88,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
88
  requirements:
92
89
  - - ">="
93
90
  - !ruby/object:Gem::Version
94
- hash: 3
95
91
  segments:
96
92
  - 0
97
93
  version: "0"