hash_dot 2.4.2 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +28 -7
- data/.travis.yml +7 -5
- data/bin/console +1 -0
- data/hash_dot.gemspec +1 -1
- data/lib/hash.rb +7 -3
- data/lib/hash_dot.rb +2 -0
- data/lib/hash_dot/version.rb +3 -1
- data/lib/symbol.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa8bb14cb875b48772a2c118ef62a6e604d863997354648c08aeb9cbcbb99689
|
4
|
+
data.tar.gz: c9b83eb8f3d753c5be3a1a093655ce55c34903df2b541641960e9c1ad8485bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f929f0fff4ae36c5761da32142278f22f757bc708065e854f0b77ed4372199b59c752802694bd4281bf2094d0bb39355ea641ce3c831a201b8e8822b98b96e
|
7
|
+
data.tar.gz: a03ed8b68b439d53f15f7c96b1243a2a3957be709bd3b633a81c0cb6d060b3f6cbcf374bb417aafa5b38917f5483e253c98d175e5dea12c04028ed5633aa1029
|
data/.rubocop.yml
CHANGED
@@ -1,25 +1,46 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.7
|
3
3
|
Include:
|
4
4
|
- 'lib/**/*'
|
5
5
|
- 'spec/**/*'
|
6
6
|
|
7
|
-
|
7
|
+
Layout/LineLength:
|
8
8
|
Max: 120
|
9
9
|
|
10
|
-
|
10
|
+
Layout/SpaceBeforeBlockBraces:
|
11
|
+
EnforcedStyle: space
|
12
|
+
|
13
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Layout/SpaceInsideParens:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/BlockDelimiters:
|
11
26
|
Enabled: false
|
12
27
|
|
13
28
|
Style/Documentation:
|
14
29
|
Enabled: false
|
15
30
|
|
31
|
+
Style/ExpandPathArguments:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/Lambda:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/MethodMissingSuper:
|
38
|
+
Enabled: false
|
39
|
+
|
16
40
|
Style/MutableConstant:
|
17
41
|
Enabled: true
|
18
42
|
|
19
|
-
Style/
|
20
|
-
EnforcedStyle: space
|
21
|
-
|
22
|
-
Style/SpaceInsideParens:
|
43
|
+
Style/MissingRespondToMissing:
|
23
44
|
Enabled: false
|
24
45
|
|
25
46
|
Style/StringLiterals:
|
data/.travis.yml
CHANGED
data/bin/console
CHANGED
data/hash_dot.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "bundler"
|
31
31
|
spec.add_development_dependency "rake"
|
32
32
|
spec.add_development_dependency "rspec"
|
33
|
-
spec.add_development_dependency "json"
|
33
|
+
spec.add_development_dependency "json", '>= 2.5.1'
|
34
34
|
spec.add_development_dependency "pry"
|
35
35
|
spec.add_development_dependency "rubocop"
|
36
36
|
end
|
data/lib/hash.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Hash
|
2
4
|
class << self
|
3
5
|
attr_accessor :use_dot_syntax
|
@@ -16,7 +18,7 @@ class Hash
|
|
16
18
|
def method_missing(method, *args)
|
17
19
|
return super(method, *args) unless to_dot?
|
18
20
|
|
19
|
-
method, chain = method.to_s.split(
|
21
|
+
method, chain = method.to_s.split(".", 2).map(&:to_sym)
|
20
22
|
|
21
23
|
return send(method).send(chain, *args) if chain
|
22
24
|
|
@@ -31,10 +33,12 @@ class Hash
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
|
-
def respond_to?(method, include_all=false)
|
36
|
+
def respond_to?(method, include_all = false)
|
35
37
|
return super(method, include_all) unless to_dot?
|
38
|
+
|
36
39
|
prop = create_prop(method)
|
37
40
|
return true if key?(prop)
|
41
|
+
|
38
42
|
super(method, include_all)
|
39
43
|
end
|
40
44
|
|
@@ -48,7 +52,7 @@ class Hash
|
|
48
52
|
end
|
49
53
|
when Hash
|
50
54
|
dotify_hash(obj, use_default: use_default)
|
51
|
-
|
55
|
+
# else no-op
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
data/lib/hash_dot.rb
CHANGED
data/lib/hash_dot/version.rb
CHANGED
data/lib/symbol.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_dot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Steel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.5.1
|
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:
|
68
|
+
version: 2.5.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
142
|
+
rubygems_version: 3.2.3
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Use dot syntax with Ruby hashes.
|