constellation 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/constellation.rb +5 -1
- data/spec/constellation_spec.rb +10 -1
- metadata +10 -10
data/lib/constellation.rb
CHANGED
@@ -29,6 +29,10 @@ module Constellation
|
|
29
29
|
fall_back_on_gems
|
30
30
|
end
|
31
31
|
|
32
|
+
def [](key)
|
33
|
+
@data[key.to_s]
|
34
|
+
end
|
35
|
+
|
32
36
|
def method_missing(name, *arguments, &block)
|
33
37
|
if data.has_key?(name.to_s)
|
34
38
|
data[name.to_s]
|
@@ -107,4 +111,4 @@ module Constellation
|
|
107
111
|
|
108
112
|
end
|
109
113
|
|
110
|
-
Class.send :include, Constellation::ActsAs
|
114
|
+
Class.send :include, Constellation::ActsAs
|
data/spec/constellation_spec.rb
CHANGED
@@ -23,6 +23,15 @@ describe Constellation do
|
|
23
23
|
File.open(full_path, 'w') { |f| f << content }
|
24
24
|
end
|
25
25
|
|
26
|
+
describe 'a configuration object' do
|
27
|
+
subject { config_class.new(foo: 'FOO') }
|
28
|
+
|
29
|
+
it('responds to properties') { subject.should respond_to(:foo) }
|
30
|
+
it('returns properties when called directly') { subject.foo.should == 'FOO' }
|
31
|
+
it('exposes properties via []') { subject[:foo].should == 'FOO' }
|
32
|
+
it('treats Symbol and String keys indifferently') { subject[:foo].should == subject['foo'] }
|
33
|
+
end
|
34
|
+
|
26
35
|
describe 'configuration sources' do
|
27
36
|
subject { config_class.new(foo: 'paramfoo') }
|
28
37
|
|
@@ -112,4 +121,4 @@ describe Constellation do
|
|
112
121
|
it('parses with the given parse method') { subject.foo.should == 'colonfoo' }
|
113
122
|
end
|
114
123
|
end
|
115
|
-
end
|
124
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constellation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
|
-
requirement: &
|
16
|
+
requirement: &70109801362700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70109801362700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70109801362020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70109801362020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fakefs
|
38
|
-
requirement: &
|
38
|
+
requirement: &70109801360920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70109801360920
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
|
-
requirement: &
|
49
|
+
requirement: &70109801360340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70109801360340
|
58
58
|
description: Load configuration settings from ENV, dotfiles, and gems
|
59
59
|
email:
|
60
60
|
- james.a.rosen@gmail.com
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- spec/constellation_spec.rb
|
68
68
|
- spec/spec_helper.rb
|
69
69
|
- spec/support/fakefs.rb
|
70
|
-
homepage:
|
70
|
+
homepage: http://github.com/jamesarosen/constellation
|
71
71
|
licenses: []
|
72
72
|
post_install_message:
|
73
73
|
rdoc_options: []
|