collapsium 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d5aaed5e0ef8dd3a68421293d500d992152ad80
4
- data.tar.gz: 54d67d56df16c00b74577fa9739991ef4d31b945
3
+ metadata.gz: 15f88a96badb4dff1a23e1eac842de71b86e4b27
4
+ data.tar.gz: 1ad64e9ec74b0d125292d1424280d149389a4609
5
5
  SHA512:
6
- metadata.gz: 49b9758e50fa515fff8390fcd44ea17c65aca94ed6c3840eb0d4bea306e21a12b16b62aed98c637fb6905beec5d9d24958a9316a332391f6edaa20e84c486d0a
7
- data.tar.gz: e702efb9a4addf4c669c3abd2b8c559ccab374896f29ef183ef6da9b580e128138e3dcd2d989ef0d826e43d1a14888b22d36d9f6f0a0369ab76f9228b01db14a
6
+ metadata.gz: a97d7feaf6c43dcd442c5342970563c7665d5d45c812284ebd24620db7a25ea5d6adf97fe73a8e16331b8587d214a4627be1c88f86021221d3fdfaa210192668
7
+ data.tar.gz: 3c8a5e286cd04e4d79957d94e3e22aef249c0be5352848f2f22b2061449637ad90f41ec1cff3d517b81d594fc83f1700332d0d7dd14801b08bf5878de87d3884
@@ -1,49 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- collapsium (0.2.1)
4
+ collapsium (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.2.0)
10
- codeclimate-test-reporter (0.5.1)
9
+ ast (2.3.0)
10
+ codeclimate-test-reporter (0.6.0)
11
11
  simplecov (>= 0.7.1, < 1.0.0)
12
12
  diff-lcs (1.2.5)
13
13
  docile (1.1.5)
14
- json (1.8.3)
14
+ json (2.0.1)
15
15
  parser (2.3.1.2)
16
16
  ast (~> 2.2)
17
17
  powerpack (0.1.1)
18
18
  rainbow (2.1.0)
19
- rake (11.1.2)
20
- rspec (3.4.0)
21
- rspec-core (~> 3.4.0)
22
- rspec-expectations (~> 3.4.0)
23
- rspec-mocks (~> 3.4.0)
24
- rspec-core (3.4.4)
25
- rspec-support (~> 3.4.0)
26
- rspec-expectations (3.4.0)
19
+ rake (11.2.2)
20
+ rspec (3.5.0)
21
+ rspec-core (~> 3.5.0)
22
+ rspec-expectations (~> 3.5.0)
23
+ rspec-mocks (~> 3.5.0)
24
+ rspec-core (3.5.1)
25
+ rspec-support (~> 3.5.0)
26
+ rspec-expectations (3.5.0)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.4.0)
29
- rspec-mocks (3.4.1)
28
+ rspec-support (~> 3.5.0)
29
+ rspec-mocks (3.5.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.4.0)
32
- rspec-support (3.4.1)
33
- rubocop (0.40.0)
34
- parser (>= 2.3.1.0, < 3.0)
31
+ rspec-support (~> 3.5.0)
32
+ rspec-support (3.5.0)
33
+ rubocop (0.41.2)
34
+ parser (>= 2.3.1.1, < 3.0)
35
35
  powerpack (~> 0.1)
36
36
  rainbow (>= 1.99.1, < 3.0)
37
37
  ruby-progressbar (~> 1.7)
38
38
  unicode-display_width (~> 1.0, >= 1.0.1)
39
39
  ruby-progressbar (1.8.1)
40
- simplecov (0.11.2)
40
+ simplecov (0.12.0)
41
41
  docile (~> 1.1.0)
42
- json (~> 1.8)
42
+ json (>= 1.8, < 3)
43
43
  simplecov-html (~> 0.10.0)
44
44
  simplecov-html (0.10.0)
45
- unicode-display_width (1.0.5)
46
- yard (0.8.7.6)
45
+ unicode-display_width (1.1.0)
46
+ yard (0.9.0)
47
47
 
48
48
  PLATFORMS
49
49
  ruby
@@ -52,11 +52,11 @@ DEPENDENCIES
52
52
  bundler (~> 1.12)
53
53
  codeclimate-test-reporter
54
54
  collapsium!
55
- rake (~> 11.1)
56
- rspec (~> 3.4)
57
- rubocop (~> 0.40)
58
- simplecov (~> 0.11)
59
- yard (~> 0.8)
55
+ rake (~> 11.2)
56
+ rspec (~> 3.5)
57
+ rubocop (~> 0.41)
58
+ simplecov (~> 0.12)
59
+ yard (~> 0.9)
60
60
 
61
61
  BUNDLED WITH
62
- 1.12.3
62
+ 1.12.5
@@ -35,11 +35,11 @@ Gem::Specification.new do |spec|
35
35
  spec.required_ruby_version = '>= 2.0'
36
36
 
37
37
  spec.add_development_dependency "bundler", "~> 1.12"
38
- spec.add_development_dependency "rubocop", "~> 0.40"
39
- spec.add_development_dependency "rake", "~> 11.1"
40
- spec.add_development_dependency "rspec", "~> 3.4"
41
- spec.add_development_dependency "simplecov", "~> 0.11"
42
- spec.add_development_dependency "yard", "~> 0.8"
38
+ spec.add_development_dependency "rubocop", "~> 0.41"
39
+ spec.add_development_dependency "rake", "~> 11.2"
40
+ spec.add_development_dependency "rspec", "~> 3.5"
41
+ spec.add_development_dependency "simplecov", "~> 0.12"
42
+ spec.add_development_dependency "yard", "~> 0.9"
43
43
  end
44
44
  # rubocop:enable Style/SpaceAroundOperators
45
45
  # rubocop:enable Style/UnneededPercentQ
@@ -98,9 +98,6 @@ module Collapsium
98
98
  if leaf.is_a? Hash
99
99
  leaf.default_proc = default_proc
100
100
  end
101
- if leaf.nil?
102
- leaf = self
103
- end
104
101
 
105
102
  # If we have a leaf, we want to send the requested method to that
106
103
  # leaf.
@@ -128,7 +125,15 @@ module Collapsium
128
125
 
129
126
  # If we're a write function, then we need to create intermediary objects,
130
127
  # i.e. what's at head if nothing is there.
131
- if options[:create] and data[head].nil?
128
+ if data[head].nil?
129
+ # If the head is nil, we can't recurse. In create mode that means we
130
+ # want to create hash children, but in read mode we're done recursing.
131
+ # By returning a hash here, we allow the caller to send methods on to
132
+ # this temporary, making a PathedAccess Hash act like any other Hash.
133
+ if not options[:create]
134
+ return {}
135
+ end
136
+
132
137
  data[head] = {}
133
138
  end
134
139
 
@@ -8,5 +8,5 @@
8
8
  #
9
9
  module Collapsium
10
10
  # The current release version
11
- VERSION = "0.2.1".freeze
11
+ VERSION = "0.3.0".freeze
12
12
  end
@@ -75,6 +75,13 @@ describe ::Collapsium::PathedAccess do
75
75
  expect(@tester["bar.baz"]).to eql "quux"
76
76
  expect(@tester[".bar.baz"]).to eql "quux"
77
77
  end
78
+
79
+ it "behaves like a hash if a child node does not exist" do
80
+ expect(@tester["asdf"]).to be_nil
81
+ expect(@tester.fetch("asdf", 42)).to eql 42
82
+ expect(@tester[".does.not.exist"]).to be_nil
83
+ expect(@tester.fetch(".does.not.exist", 42)).to eql 42
84
+ end
78
85
  end
79
86
 
80
87
  describe "with indifferent access" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collapsium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Finkhaeuser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-06 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,70 +30,70 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.40'
33
+ version: '0.41'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.40'
40
+ version: '0.41'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '11.1'
47
+ version: '11.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '11.1'
54
+ version: '11.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.4'
61
+ version: '3.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.4'
68
+ version: '3.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.11'
75
+ version: '0.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.11'
82
+ version: '0.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: yard
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.8'
89
+ version: '0.9'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.8'
96
+ version: '0.9'
97
97
  description: "\n Provides IndifferentAccess, RecursiveMerge, PathedAccess, etc.\n
98
98
  \ "
99
99
  email: