config_file 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/config_file/include.rb +4 -1
- data/lib/config_file/version.rb +1 -1
- data/spec/include_spec.rb +15 -0
- metadata +5 -5
data/lib/config_file/include.rb
CHANGED
@@ -4,6 +4,10 @@ module ConfigFile
|
|
4
4
|
|
5
5
|
def config_file_name=file
|
6
6
|
@config_file = ConfigFile.send(file)
|
7
|
+
__setup_config_methods__
|
8
|
+
@config_file
|
9
|
+
rescue UnknownConfigFile
|
10
|
+
@config_file
|
7
11
|
end
|
8
12
|
|
9
13
|
def __setup_config_methods__
|
@@ -32,6 +36,5 @@ module ConfigFile
|
|
32
36
|
receiver.send :include, InstanceMethods
|
33
37
|
|
34
38
|
receiver.config_file_name = word
|
35
|
-
receiver.__setup_config_methods__
|
36
39
|
end
|
37
40
|
end
|
data/lib/config_file/version.rb
CHANGED
data/spec/include_spec.rb
CHANGED
@@ -4,6 +4,11 @@ module IncludeTest
|
|
4
4
|
include ConfigFile
|
5
5
|
end
|
6
6
|
|
7
|
+
module Test2
|
8
|
+
include ConfigFile
|
9
|
+
self.config_file_name = 'include_test'
|
10
|
+
end
|
11
|
+
|
7
12
|
describe "ConfigFile" do
|
8
13
|
it "should look for include_test.yml" do
|
9
14
|
IncludeTest.config_file.should_not be_a(ConfigFile::File)
|
@@ -18,4 +23,14 @@ describe "ConfigFile" do
|
|
18
23
|
IncludeTest.key1.should == 'key1'
|
19
24
|
IncludeTest.key2.should == 'key2'
|
20
25
|
end
|
26
|
+
|
27
|
+
it "should define methods for each key" do
|
28
|
+
Test2.should respond_to(:key1)
|
29
|
+
Test2.should respond_to(:key2)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return expected value" do
|
33
|
+
Test2.key1.should == 'key1'
|
34
|
+
Test2.key2.should == 'key2'
|
35
|
+
end
|
21
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-22 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blankslate
|
16
|
-
requirement: &
|
16
|
+
requirement: &70102003897160 !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: *70102003897160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70102003896680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70102003896680
|
36
36
|
description: Gem for quickly reading from config files
|
37
37
|
email:
|
38
38
|
- me@tal.by
|