dot_hash 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/dot_hash/settings.rb
CHANGED
@@ -3,7 +3,7 @@ module DotHash
|
|
3
3
|
attr_reader :configs
|
4
4
|
|
5
5
|
def initialize(configs, wrapper=Properties)
|
6
|
-
@configs =
|
6
|
+
@configs = wrapper.new(configs)
|
7
7
|
end
|
8
8
|
|
9
9
|
def method_missing(key, *args, &block)
|
@@ -48,7 +48,7 @@ module DotHash
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def get_hash_from_file(file)
|
51
|
-
return {} unless file =~ /\.(yaml|yml)
|
51
|
+
return {} unless file =~ /\.(yaml|yml)$/
|
52
52
|
YAML.load_file(file)
|
53
53
|
end
|
54
54
|
|
data/lib/dot_hash/version.rb
CHANGED
@@ -102,6 +102,12 @@ module DotHash
|
|
102
102
|
Settings.rogue.attr.power.must_equal 11
|
103
103
|
end
|
104
104
|
|
105
|
+
it "does not load files without the yaml extension" do
|
106
|
+
Settings.load fixtures_path("config.yaml.example")
|
107
|
+
|
108
|
+
-> { Settings.alive }.must_raise NoMethodError
|
109
|
+
end
|
110
|
+
|
105
111
|
it "loads from a directory" do
|
106
112
|
Settings.load fixtures_path
|
107
113
|
Settings.rogue.attr.speed.must_equal 25
|
@@ -0,0 +1 @@
|
|
1
|
+
alive: true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dot_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- test/dot_hash/hash_to_properties_test.rb
|
50
50
|
- test/dot_hash/properties_test.rb
|
51
51
|
- test/dot_hash/settings_test.rb
|
52
|
+
- test/fixtures/config.yaml.example
|
52
53
|
- test/fixtures/configs1.yaml
|
53
54
|
- test/fixtures/configs2.yaml
|
54
55
|
- test/test_helper.rb
|
@@ -66,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
67
|
version: '0'
|
67
68
|
segments:
|
68
69
|
- 0
|
69
|
-
hash: -
|
70
|
+
hash: -2180397336244030562
|
70
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
72
|
none: false
|
72
73
|
requirements:
|
@@ -75,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
76
|
version: '0'
|
76
77
|
segments:
|
77
78
|
- 0
|
78
|
-
hash: -
|
79
|
+
hash: -2180397336244030562
|
79
80
|
requirements: []
|
80
81
|
rubyforge_project:
|
81
82
|
rubygems_version: 1.8.24
|
@@ -86,6 +87,7 @@ test_files:
|
|
86
87
|
- test/dot_hash/hash_to_properties_test.rb
|
87
88
|
- test/dot_hash/properties_test.rb
|
88
89
|
- test/dot_hash/settings_test.rb
|
90
|
+
- test/fixtures/config.yaml.example
|
89
91
|
- test/fixtures/configs1.yaml
|
90
92
|
- test/fixtures/configs2.yaml
|
91
93
|
- test/test_helper.rb
|