porch 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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/porch/context.rb +5 -5
- data/lib/porch/version.rb +1 -1
- data/pkg/porch-0.2.1.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9cef9297ff144b552ab8420b515835966552f80
|
4
|
+
data.tar.gz: 3af8a85e568ef39b7c7a8dcea322db10771e116b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1872d33f21dcae52e1a899201bf911511e4aeb09c891bbb109712567aa8ed93af03d4f24a2917cb80edbc1d80700066e8ff0005fe6bb106451bcc660954d9fec
|
7
|
+
data.tar.gz: acdc0dca275b84e6c27a2d2649f1a6ae706fe831fbf0d47354a4e9a2d8f1acc454eebfd598041cd2d84ae982f570bea9f31478580407ec78a10a0c3ba092ec3e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -240,19 +240,19 @@ Several helper methods are included in the `Porch::Context` to guard against an
|
|
240
240
|
```
|
241
241
|
class SomeStep
|
242
242
|
def call(context)
|
243
|
-
context.
|
243
|
+
context.guard_with_skipping { required(:email) }
|
244
244
|
# The rest of the action will not be performed and the rest of the actions will be
|
245
245
|
# skipped if the guard fails
|
246
246
|
end
|
247
247
|
end
|
248
248
|
```
|
249
249
|
|
250
|
-
`Porch::Context#
|
250
|
+
`Porch::Context#guard_with_failure` (with a bang(!)) can be used and if the validation fails, the `Context` will be marked as a failure. The failure message for the `Context` will be set to be a comma-seperated list of the context errors that failed.
|
251
251
|
|
252
252
|
```
|
253
253
|
class SomeStep
|
254
254
|
def call(context)
|
255
|
-
context.
|
255
|
+
context.guard_with_failure { required(:email) }
|
256
256
|
# The rest of the action will not be performed and the rest of the actions will be
|
257
257
|
# skipped and the action will be marked as failed if the guard fails
|
258
258
|
end
|
data/lib/porch/context.rb
CHANGED
@@ -27,14 +27,14 @@ module Porch
|
|
27
27
|
!success?
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
result =
|
30
|
+
def guard_with_skipping(&block)
|
31
|
+
result = guard &block
|
32
32
|
skip_remaining! if result.failure?
|
33
33
|
result
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
result =
|
36
|
+
def guard_with_failure(&block)
|
37
|
+
result = guard &block
|
38
38
|
fail!(HumanError.new(result.errors).message) if result.failure?
|
39
39
|
result
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module Porch
|
|
44
44
|
super
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def skip_next(&block)
|
48
48
|
result = Guard.new(self).against(&block)
|
49
49
|
raise Porch::ContextStoppedError.new(self) if result.failure?
|
50
50
|
result
|
data/lib/porch/version.rb
CHANGED
data/pkg/porch-0.2.1.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: porch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/porch/version.rb
|
101
101
|
- pkg/porch-0.1.0.gem
|
102
102
|
- pkg/porch-0.2.0.gem
|
103
|
+
- pkg/porch-0.2.1.gem
|
103
104
|
- porch.gemspec
|
104
105
|
homepage: https://github.com/jwright/porch
|
105
106
|
licenses:
|