hashr 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hashr (0.0.6)
4
+ hashr (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -36,7 +36,7 @@ Be aware that by default missing keys won't raise an exception but instead behav
36
36
  config.foo? # => false
37
37
  config.foo # => nil
38
38
 
39
- You can make Hashr to raise an `IndexError` though like this:
39
+ You can make Hashr raise an `IndexError` though like this:
40
40
 
41
41
  Hashr.raise_missing_keys = true
42
42
  config = Hashr.new
data/lib/hashr.rb CHANGED
@@ -18,7 +18,7 @@ class Hashr < Hash
18
18
  end
19
19
 
20
20
  def initialize(data = {}, definition = self.class.definition)
21
- replace(deep_hashrize(definition.deep_merge(data.deep_symbolize_keys)))
21
+ replace(deep_hashrize(definition.deep_merge((data || {}).deep_symbolize_keys)))
22
22
  end
23
23
 
24
24
  def []=(key, value)
data/lib/hashr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hashr < Hash
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/test/hashr_test.rb CHANGED
@@ -5,6 +5,10 @@ class HashrTest < Test::Unit::TestCase
5
5
  Hashr.raise_missing_keys = false
6
6
  end
7
7
 
8
+ test 'initialize takes nil' do
9
+ assert_nothing_raised { Hashr.new(nil) }
10
+ end
11
+
8
12
  test 'method access on an existing key returns the value' do
9
13
  assert_equal 'foo', Hashr.new({ :foo => 'foo' }).foo
10
14
  end
metadata CHANGED
@@ -1,62 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hashr
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 8
10
- version: 0.0.8
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sven Fuchs
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-24 00:00:00 +02:00
12
+ date: 2011-07-25 00:00:00.000000000 +02:00
19
13
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2165518780 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
33
23
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: test_declarative
37
24
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2165518780
26
+ - !ruby/object:Gem::Dependency
27
+ name: test_declarative
28
+ requirement: &2165518260 !ruby/object:Gem::Requirement
39
29
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 27
44
- segments:
45
- - 0
46
- - 0
47
- - 2
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
48
33
  version: 0.0.2
49
34
  type: :development
50
- version_requirements: *id002
51
- description: Simple Hash extension to make working with nested hashes (e.g. for configuration) easier and less error-prone.
35
+ prerelease: false
36
+ version_requirements: *2165518260
37
+ description: Simple Hash extension to make working with nested hashes (e.g. for configuration)
38
+ easier and less error-prone.
52
39
  email: svenfuchs@artweb-design.de
53
40
  executables: []
54
-
55
41
  extensions: []
56
-
57
42
  extra_rdoc_files: []
58
-
59
- files:
43
+ files:
60
44
  - lib/hashr/core_ext/ruby/hash.rb
61
45
  - lib/hashr/env_defaults.rb
62
46
  - lib/hashr/version.rb
@@ -71,36 +55,27 @@ files:
71
55
  has_rdoc: true
72
56
  homepage: http://github.com/svenfuchs/hashr
73
57
  licenses: []
74
-
75
58
  post_install_message:
76
59
  rdoc_options: []
77
-
78
- require_paths:
60
+ require_paths:
79
61
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
62
+ required_ruby_version: !ruby/object:Gem::Requirement
81
63
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
69
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
98
74
  requirements: []
99
-
100
- rubyforge_project: "[none]"
75
+ rubyforge_project: ! '[none]'
101
76
  rubygems_version: 1.6.2
102
77
  signing_key:
103
78
  specification_version: 3
104
- summary: Simple Hash extension to make working with nested hashes (e.g. for configuration) easier and less error-prone
79
+ summary: Simple Hash extension to make working with nested hashes (e.g. for configuration)
80
+ easier and less error-prone
105
81
  test_files: []
106
-