definition 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Changelog.md +4 -0
- data/README.md +13 -0
- data/lib/definition/conform_error.rb +1 -1
- data/lib/definition/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6aec63e9d3de5239b90b510ddb7fa4093382eefe1d9b195661cb49e3b5e811dd
|
4
|
+
data.tar.gz: fa97d19afca5fa14c94e768ae14c4ab666d24ecac4adb9e01c129322ee53b7e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 032bff254f868733729fae831ca8d387339341ee5206765b422b72ba02033d599fe2cbb392fe0717d578838fd8b08e403c72371c503995d9cbb23c3d8e8555f5
|
7
|
+
data.tar.gz: d64beb3207aefaabd42d549688edcf10baa26734dfcdd64470332ee0a02c3679ec7e1a0eef62ecd82399d215b84695166fbea88c0bd6bd0853662e9b4eb02be1
|
data/Changelog.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.5.1] - 2019-04-27
|
8
|
+
### Fixed
|
9
|
+
- Typo in error debug output
|
10
|
+
|
7
11
|
## [0.5.0] - 2019-03-28
|
8
12
|
### Added
|
9
13
|
- CoercibleValueObject Definition for better nesting of ValueObjects
|
data/README.md
CHANGED
@@ -343,11 +343,24 @@ Definition.Boolean.conform(tru) # => pass
|
|
343
343
|
```ruby
|
344
344
|
Definition.Equal(5).conform(5) # => pass
|
345
345
|
Definition.Equal("foo").conform("foo") # => pass
|
346
|
+
```
|
347
|
+
|
348
|
+
The Nilable Definition allows a value to be nil or to conform
|
349
|
+
with the definition you pass it as argument:
|
346
350
|
|
351
|
+
```ruby
|
347
352
|
Definition.Nilable(Definition.Type(String)).conform(nil) # => pass
|
348
353
|
Definition.Nilable(Definition.Type(String)).conform("foo") # => pass
|
349
354
|
```
|
350
355
|
|
356
|
+
The Enum Definition checks if the input equals one of the values you pass it as argument. You can pass in as many arguments as you like:
|
357
|
+
|
358
|
+
```ruby
|
359
|
+
Definition.Enum("foo", 1, 2.0).conform("foo") # => pass
|
360
|
+
Definition.Enum("foo", 1, 2.0).conform(1) # => pass
|
361
|
+
Definition.Enum("foo", 1, 2.0).conform("bar) # => fail
|
362
|
+
```
|
363
|
+
|
351
364
|
### Examples
|
352
365
|
|
353
366
|
Check out the [integration specs](./spec/integration) for more usage examples.
|
@@ -24,7 +24,7 @@ module Definition
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def to_s
|
27
|
-
"<Definition::ConformError \n\t
|
27
|
+
"<Definition::ConformError \n\t message: \"#{message}\", \n\t json_pointer: \"#{json_pointer}\">"
|
28
28
|
end
|
29
29
|
|
30
30
|
alias inspect to_s
|
data/lib/definition/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: definition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Goltermann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
299
|
version: '0'
|
300
300
|
requirements: []
|
301
301
|
rubyforge_project:
|
302
|
-
rubygems_version: 2.
|
302
|
+
rubygems_version: 2.7.6
|
303
303
|
signing_key:
|
304
304
|
specification_version: 4
|
305
305
|
summary: Simple and composable validation and coercion of data structures inspired
|