shaped 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -2
- data/lib/shaped.rb +1 -0
- data/lib/shaped/shapes/hash.rb +0 -9
- data/lib/shaped/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f6ca9518d2b3b0b55988f53d055a48c1344c54d6c8f8497877fb48e8ad621e1
|
4
|
+
data.tar.gz: c7e2be555928b918681670b803ea95b70ad97da25f0b4079be7fa6f16c4f6892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59c995d6a92d07d29b87a565924dbd175f8bce9e7ce158bdc98cf450aa5fb8e5073f78e6eeea5be0a140045e838e3562da9a2562a3263666dceeac23b7ac0368
|
7
|
+
data.tar.gz: 4c3b1e10af00279e075c7094a06b07b8624f3fc165fcea3704db18a5d52ec48b58bf9a8dffd31320465f2bad598d820f193f901be9bbe7f29e2852e7d8eda5a3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v0.6.4 (2020-06-22)
|
2
|
+
### Fixed
|
3
|
+
- Make it possible to specify optional keys in a Hash shape (using an `Or` shape as the value)
|
4
|
+
|
5
|
+
### Docs
|
6
|
+
- Remove explicit `git push` from release instructions
|
7
|
+
|
1
8
|
## v0.6.3 (2020-06-21)
|
2
9
|
### Docs
|
3
10
|
- Add badges for Dependabot status and RubyGems version
|
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
shaped (0.6.
|
13
|
+
shaped (0.6.4)
|
14
14
|
activemodel (~> 6.0)
|
15
15
|
activesupport (~> 6.0)
|
16
16
|
|
@@ -71,7 +71,7 @@ GEM
|
|
71
71
|
byebug (~> 11.0)
|
72
72
|
pry (~> 0.13.0)
|
73
73
|
rainbow (3.0.0)
|
74
|
-
rake (
|
74
|
+
rake (13.0.1)
|
75
75
|
rb-fsevent (0.10.4)
|
76
76
|
rb-inotify (0.10.1)
|
77
77
|
ffi (~> 1.0)
|
data/README.md
CHANGED
@@ -358,8 +358,7 @@ To release a new version:
|
|
358
358
|
3. update the version number in `version.rb`
|
359
359
|
4. `bundle install` (which will update `Gemfile.lock`)
|
360
360
|
5. commit the changes with a message like `Prepare to release v0.1.1`
|
361
|
-
6.
|
362
|
-
7. run `bin/release` (which will create a git tag for the version, push git commits and
|
361
|
+
6. run `bin/release` (which will create a git tag for the version, push git commits and
|
363
362
|
tags to GitHub, and push the gem to RubyGems)
|
364
363
|
|
365
364
|
# License
|
data/lib/shaped.rb
CHANGED
@@ -27,6 +27,7 @@ module Shaped
|
|
27
27
|
end
|
28
28
|
|
29
29
|
case shape_description
|
30
|
+
when Shaped::Shape then shape_description
|
30
31
|
when Hash then Shaped::Shapes::Hash.new(shape_description)
|
31
32
|
when Array then Shaped::Shapes::Array.new(shape_description)
|
32
33
|
when Class then Shaped::Shapes::Class.new(shape_description, validation_options)
|
data/lib/shaped/shapes/hash.rb
CHANGED
@@ -12,9 +12,6 @@ class Shaped::Shapes::Hash < Shaped::Shape
|
|
12
12
|
def matched_by?(hash)
|
13
13
|
return false if !hash.is_a?(Hash)
|
14
14
|
|
15
|
-
missing_keys = expected_keys - hash.keys
|
16
|
-
return false if missing_keys.any?
|
17
|
-
|
18
15
|
@hash_description.all? do |key, expected_value_shape|
|
19
16
|
expected_value_shape.matched_by?(hash[key])
|
20
17
|
end
|
@@ -28,10 +25,4 @@ class Shaped::Shapes::Hash < Shaped::Shape
|
|
28
25
|
|
29
26
|
"{ #{printable_shape_description} }"
|
30
27
|
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def expected_keys
|
35
|
-
@hash_description.keys
|
36
|
-
end
|
37
28
|
end
|
data/lib/shaped/version.rb
CHANGED