pathway 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 18bbd2169b9b1ce06075cb6b44ba3785f5853019
4
- data.tar.gz: 6d94d279e070945bffd59a23e20a4fbcf7a90219
2
+ SHA256:
3
+ metadata.gz: d286f1d75ae6776baa9113bd4dae0da6f30685723173cee2a971a02d134223f6
4
+ data.tar.gz: ab88b4c578bde709d3dbeff0dd6e97f5f2da884cb9151a73303e08b9888f60a6
5
5
  SHA512:
6
- metadata.gz: '095c9f17c4484b2dd8da4d9d98ac37e41845b4493c703cb98704bf2523f5cd14656528dd162f47cda8d4ea940e53861c351d1b9f7888c0589a36f562c7fa1bb8'
7
- data.tar.gz: 5213eb74c0080d343f9e52a6f805101cd5a4052e7bd7dbad3d83fa01f4b15e502fcf212b2a8e1d666d41af8d6449cd15cbc2c78b2f363dab41fd947d32c13204
6
+ metadata.gz: 41c27065b1bba5907eab6b00fc76799fa17f89a0d9e292e58b9eff2a1a06f8813a737c08ca5b13e5c8aad62a60442f8135c56df1b301b205ad6aeabe8f92189d
7
+ data.tar.gz: df7cc1e6293f27135cbfa25f0aed776afd637f62128182c1caaf961b08189ffc322f1e12beb8e572e68ab1624808a6549803559582d87d4a6870d52388054df4
data/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
+ ## [0.9.0] - 2019-04-01
2
+ ### Changed
3
+ - Changed behavior for `:after_commit` step wrapper, on `:sequel_models` plugin, to capture current state and reuse it later when executing.
4
+
5
+ ### Fixed
6
+ - Allow invoking `call` directly on an operation class even if the `:responder` plugin is not loaded.
7
+
1
8
  ## [0.8.0] - 2018-10-01
2
9
  ### Changed
3
10
  - Added support for `dry-validation` 0.12.x
4
- - Renamed DSL method `sequence` to `around`. Keep `sequence` as an alias although, it may be deprecated on a future mayor release.
11
+ - Renamed DSL method `sequence` to `around`. Keep `sequence` as an alias, although it may be deprecated on a future mayor release.
5
12
  - Renamed DSL method `guard` to `if_true`. Keep `guard` as an alias, although it may be deprecated on a future mayor release.
6
- - Added DSL method `if_false`, which behaves like `if_true` but checks the passed predicate is false instead.
13
+ - Added DSL method `if_false`, which behaves like `if_true` but checks if the passed predicate is false instead.
7
14
  - Moved `Responder` class inside the `responder` plugin module.
8
15
 
9
16
  ## [0.7.0] - 2018-09-25
@@ -13,7 +20,7 @@
13
20
  - Allow `authorization` block to take multiple parameters on `simple_auth` plugin.
14
21
 
15
22
  ## [0.6.2] - 2018-05-19
16
- ### Fixes
23
+ ### Fixed
17
24
  - Allow `:error_message` option for `sequel_models` plugin to propagate down inherited classes
18
25
 
19
26
  ## [0.6.1] - 2018-03-16
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- ruby '2.4.0'
1
+ ruby '2.5.1'
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
data/lib/pathway.rb CHANGED
@@ -77,15 +77,20 @@ module Pathway
77
77
  module Base
78
78
  module ClassMethods
79
79
  attr_accessor :result_key
80
+ alias :result_at :result_key=
80
81
 
81
82
  def process(&bl)
82
83
  dsl = self::DSL
83
84
  define_method(:call) do |input|
84
- dsl.new(self, input).run(&bl).then(&:result)
85
+ dsl.new(State.new(self, input: input), self)
86
+ .run(&bl)
87
+ .then(&:result)
85
88
  end
86
89
  end
87
90
 
88
- alias :result_at :result_key=
91
+ def call(ctx, *params)
92
+ new(ctx).call(*params)
93
+ end
89
94
 
90
95
  def inherited(subclass)
91
96
  super
@@ -120,9 +125,8 @@ module Pathway
120
125
  end
121
126
 
122
127
  module DSLMethods
123
- def initialize(operation, input)
124
- @result = wrap(State.new(operation, input: input))
125
- @operation = operation
128
+ def initialize(state, operation)
129
+ @result, @operation = wrap(state), operation
126
130
  end
127
131
 
128
132
  def run(&bl)
@@ -155,7 +159,7 @@ module Pathway
155
159
 
156
160
  def around(wrapper, &steps)
157
161
  @result.then do |state|
158
- seq = -> { @result = dup.run(&steps) }
162
+ seq = -> (dsl = self) { @result = dsl.run(&steps) }
159
163
  _callable(wrapper).call(seq, state)
160
164
  end
161
165
  end
@@ -76,7 +76,7 @@ module Pathway
76
76
  operation.auto_wire_options = auto_wire_options
77
77
  end
78
78
 
79
- if Dry::Validation::VERSION[/\A0\.(\d+).\d+\Z/, 1].to_i >= 12
79
+ if Gem.loaded_specs['dry-validation'].version >= Gem::Version.new('0.12')
80
80
  DefaultFormClass = Dry::Validation::Schema::Params
81
81
 
82
82
  module ClassMethods
@@ -3,7 +3,7 @@ module Pathway
3
3
  module Responder
4
4
  module ClassMethods
5
5
  def call(ctx, *params, &bl)
6
- result = new(ctx).call(*params)
6
+ result = super(ctx, *params)
7
7
  block_given? ? Responder.respond(result, &bl) : result
8
8
  end
9
9
  end
@@ -13,9 +13,11 @@ module Pathway
13
13
  end
14
14
 
15
15
  def after_commit(&bl)
16
- around(-> steps, _ {
16
+ around(-> steps, state {
17
+ dsl = self.class::DSL.new(State.new(self, state.to_h.dup), self)
18
+
17
19
  db.after_commit do
18
- steps.call
20
+ steps.call(dsl)
19
21
  end
20
22
  }, &bl)
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module Pathway
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
data/pathway.gemspec CHANGED
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "coveralls"
35
35
  spec.add_development_dependency "pry"
36
36
  spec.add_development_dependency "pry-byebug"
37
+ spec.add_development_dependency "pry-doc"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pathway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Herrero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-inflector
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry-doc
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  description: Define your business logic in simple steps.
154
168
  email:
155
169
  - pablodherrero@gmail.com
@@ -206,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
220
  version: '0'
207
221
  requirements: []
208
222
  rubyforge_project:
209
- rubygems_version: 2.6.9
223
+ rubygems_version: 2.7.7
210
224
  signing_key:
211
225
  specification_version: 4
212
226
  summary: Define your business logic in simple steps.