porch 0.2.1 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04e04f39b35881268ed6e64d143ef45429951467
4
- data.tar.gz: 5c6caa30d321876b6c6e732951124ad3a1003302
3
+ metadata.gz: d9cef9297ff144b552ab8420b515835966552f80
4
+ data.tar.gz: 3af8a85e568ef39b7c7a8dcea322db10771e116b
5
5
  SHA512:
6
- metadata.gz: 61e291e87a7b2081b40d48e59db70588e2fd3e36925158f5c348877c1787267238efe36b0272c3d5702faf3abaa2fe60081a887a2d73eb493f11f08fc309556d
7
- data.tar.gz: e2d7d7705a1f3da1f2dfa3cea70962d94c4cfdf6eeae51f7eb284693a170b00c6e00b14d49750ce2a8e271dcda6580e9414d930abcbeaeb508604f148cde4915
6
+ metadata.gz: 1872d33f21dcae52e1a899201bf911511e4aeb09c891bbb109712567aa8ed93af03d4f24a2917cb80edbc1d80700066e8ff0005fe6bb106451bcc660954d9fec
7
+ data.tar.gz: acdc0dca275b84e6c27a2d2649f1a6ae706fe831fbf0d47354a4e9a2d8f1acc454eebfd598041cd2d84ae982f570bea9f31478580407ec78a10a0c3ba092ec3e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- porch (0.2.1)
4
+ porch (0.3.0)
5
5
  dry-validation (~> 0.10.4)
6
6
 
7
7
  GEM
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.guard { required(:email) }
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#guard!` (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.
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.guard! { required(:email) }
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 guard(&block)
31
- result = super
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 guard!(&block)
37
- result = Guard.new(self).against(&block)
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 next(&block)
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
@@ -1,3 +1,3 @@
1
1
  module Porch
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.1
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-01-10 00:00:00.000000000 Z
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: