dot_hash 0.5.1 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
3
+ - 1.9.3-p194
4
+ - 2.0.0-p0
@@ -28,6 +28,10 @@ module DotHash
28
28
  def load(*args)
29
29
  @instance = new HashLoader.new(*args).load
30
30
  end
31
+
32
+ def namespace(namespace)
33
+ @instance = @instance[namespace]
34
+ end
31
35
  end
32
36
  end
33
37
  end
@@ -1,3 +1,3 @@
1
1
  module DotHash
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -0,0 +1,31 @@
1
+ require_relative "../test_helper"
2
+
3
+ class CustomSettings < DotHash::Settings
4
+ load attributes: {power: 10, skills: ["fireball", "frost"]}
5
+ end
6
+
7
+ describe CustomSettings do
8
+ it "loads the the settings files" do
9
+ CustomSettings.attributes.power.must_equal 10
10
+ CustomSettings.attributes.skills.must_equal ["fireball", "frost"]
11
+ end
12
+
13
+ it "loads the settings within the namespace" do
14
+ CustomSettings.namespace "attributes"
15
+ CustomSettings.power.must_equal 10
16
+ CustomSettings.skills.must_equal ["fireball", "frost"]
17
+ end
18
+ end
19
+
20
+
21
+ class CustomSettings2 < DotHash::Settings
22
+ load attributes: {power: 10, name: "Eden", skills: ["fireball", "frost"]}
23
+ namespace :attributes
24
+ end
25
+
26
+ describe CustomSettings2 do
27
+ it "loads the settings within the namespace" do
28
+ CustomSettings.power.must_equal 10
29
+ CustomSettings.skills.must_equal ["fireball", "frost"]
30
+ end
31
+ end
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.5.1
4
+ version: 0.5.4
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-05-13 00:00:00.000000000 Z
12
+ date: 2013-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -47,6 +47,7 @@ files:
47
47
  - lib/dot_hash/properties.rb
48
48
  - lib/dot_hash/settings.rb
49
49
  - lib/dot_hash/version.rb
50
+ - test/dot_hash/custom_settings_test.rb
50
51
  - test/dot_hash/hash_loader_test.rb
51
52
  - test/dot_hash/hash_to_properties_test.rb
52
53
  - test/dot_hash/properties_test.rb
@@ -70,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
71
  version: '0'
71
72
  segments:
72
73
  - 0
73
- hash: -934662971166829267
74
+ hash: -2644970010809512324
74
75
  required_rubygems_version: !ruby/object:Gem::Requirement
75
76
  none: false
76
77
  requirements:
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  version: '0'
80
81
  segments:
81
82
  - 0
82
- hash: -934662971166829267
83
+ hash: -2644970010809512324
83
84
  requirements: []
84
85
  rubyforge_project:
85
86
  rubygems_version: 1.8.24
@@ -87,6 +88,7 @@ signing_key:
87
88
  specification_version: 3
88
89
  summary: Converts hash.to_properties so you can access values using properties.some_key
89
90
  test_files:
91
+ - test/dot_hash/custom_settings_test.rb
90
92
  - test/dot_hash/hash_loader_test.rb
91
93
  - test/dot_hash/hash_to_properties_test.rb
92
94
  - test/dot_hash/properties_test.rb