pathway 1.1.0 → 1.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
  SHA256:
3
- metadata.gz: 72fdb918cf09f7e3121e4d745362485a23f5cac7939ff7b466cba0ff1dd5f5a7
4
- data.tar.gz: edbe3a656d48496b67c793fb143c7b99860e8f4c610b54fdf9a4bad21094fc41
3
+ metadata.gz: d647d15611dc847cac56d22ff0b7dd34236ee8d67b62ffd84b7a252925f4c84a
4
+ data.tar.gz: 94ef8ed2ebd848e222e180b91e2c8969768cde5fcb1a65644c41f9adb4ee45ab
5
5
  SHA512:
6
- metadata.gz: d48ca6b5854a6ef671312323d6469b3832889f2bedfb43954221b976ad2cc96d696066af6df44fdecb67847c8c2484f047d762185ef9b559e9a286500c7ef05b
7
- data.tar.gz: 423a1d02a20d6fa794e46d9b40c2bc982c3205194416ea9e020c932e816b0bd9b3f55bf3df92a0bb4ba7a8e16156eba1cfaaf8fbab5169f0b926ec239c82cc82
6
+ metadata.gz: 60fac55bfa9c5105883209c9f44ea151a21e0720efd8e237bd66a06c46addf5c40c5c54ee24a69197aa9fd742c7a68edc4594c97365392f1e55711673ed4a80e
7
+ data.tar.gz: 03bb1724a76ea42a3bc079c7a349c740f55e82c13c4510308326465429c855cc6f949cb5ede7235fdb1f7c0e5f4a5e842c81ebf794423a011a07a07553763edf
@@ -11,19 +11,42 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.2, 3.3, 3.4]
14
+ ruby-version: [3.3, 3.4, 4.0]
15
15
  steps:
16
16
  - uses: actions/checkout@v3
17
17
  - name: Set up Ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
20
  ruby-version: ${{ matrix.ruby-version }}
21
- bundler: '2.4.22'
21
+ bundler: '2.5.6'
22
22
  bundler-cache: true
23
23
  - name: Run tests
24
24
  run: bundle exec rake
25
+ coveralls:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: '4.0'
33
+ bundler: '2.5.6'
34
+ bundler-cache: true
35
+ - name: Run tests for coverage
36
+ run: bundle exec rake
25
37
  - name: Coveralls GitHub Action
26
- if: matrix.ruby-version == '3.4'
27
38
  uses: coverallsapp/github-action@v2
28
39
  with:
29
40
  github-token: ${{ secrets.GITHUB_TOKEN }}
41
+ rubocop:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v3
45
+ - name: Set up Ruby
46
+ uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: '4.0'
49
+ bundler: '2.5.6'
50
+ bundler-cache: true
51
+ - name: Run RuboCop
52
+ run: bundle exec rubocop --force-exclusion
data/.rubocop.yml ADDED
@@ -0,0 +1,137 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://docs.rubocop.org/rubocop/configuration
11
+
12
+ plugins:
13
+ - rubocop-performance
14
+ - rubocop-rake
15
+
16
+ AllCops:
17
+ NewCops: enable
18
+ SuggestExtensions: false
19
+ Exclude:
20
+ - 'bin/*'
21
+ - 'vendor/**/*'
22
+
23
+ Style/Alias:
24
+ EnforcedStyle: prefer_alias_method
25
+
26
+ Style/StringLiterals:
27
+ EnforcedStyle: double_quotes
28
+
29
+ Style/HashSyntax:
30
+ Exclude:
31
+ - Rakefile
32
+
33
+ Metrics/BlockLength:
34
+ Exclude:
35
+ - 'spec/**/*.rb'
36
+ - 'lib/pathway/rspec/matchers/*.rb'
37
+ - 'pathway.gemspec'
38
+
39
+ Layout/EmptyLinesAroundBlockBody:
40
+ Exclude:
41
+ - 'spec/**/*.rb'
42
+
43
+ Layout/MultilineMethodCallIndentation:
44
+ EnforcedStyle: indented_relative_to_receiver
45
+
46
+ Naming/MethodParameterName:
47
+ MinNameLength: 2
48
+
49
+ Lint/MissingSuper:
50
+ AllowedParentClasses: [Result]
51
+
52
+ Style/AccessModifierDeclarations:
53
+ AllowModifiersOnAliasMethod: true
54
+
55
+ Gemspec/DevelopmentDependencies:
56
+ Enabled: true
57
+ EnforcedStyle: gemspec
58
+
59
+ Layout/HashAlignment:
60
+ EnforcedHashRocketStyle: table
61
+
62
+ Metrics/CyclomaticComplexity:
63
+ Max: 8
64
+
65
+ Metrics/AbcSize:
66
+ Max: 23
67
+
68
+ Metrics/MethodLength:
69
+ Max: 15
70
+
71
+ Metrics/PerceivedComplexity:
72
+ Max: 10
73
+
74
+ # Permanently Disabled
75
+ Style/GuardClause:
76
+ Enabled: false
77
+
78
+ Style/LambdaCall:
79
+ Enabled: false
80
+
81
+ Style/StringConcatenation:
82
+ Enabled: false
83
+
84
+ Style/Lambda:
85
+ Enabled: false
86
+
87
+ Style/Documentation:
88
+ Enabled: false
89
+
90
+ Layout/EmptyLinesAroundAccessModifier:
91
+ Enabled: false
92
+
93
+ Gemspec/OrderedDependencies:
94
+ Enabled: false
95
+
96
+ Style/ParallelAssignment:
97
+ Enabled: False
98
+
99
+ Style/TrailingCommaInHashLiteral:
100
+ Enabled: False
101
+
102
+ Style/RedundantSelf:
103
+ Enabled: False
104
+
105
+ Style/IfUnlessModifier:
106
+ Enabled: False
107
+
108
+ Lint/EmptyClass:
109
+ Enabled: False
110
+
111
+ # TODO: Temporally Disabled
112
+ Style/SafeNavigation:
113
+ Enabled: False
114
+
115
+ Layout/LeadingCommentSpace:
116
+ Enabled: False
117
+
118
+ Style/NumericLiterals:
119
+ Enabled: False
120
+
121
+ Style/CaseEquality:
122
+ Enabled: False
123
+
124
+ Performance/RedundantBlockCall:
125
+ Enabled: False
126
+
127
+ Lint/ConstantDefinitionInBlock:
128
+ Enabled: false
129
+
130
+ Layout/LineLength:
131
+ Enabled: false
132
+
133
+ Layout/SpaceInsideHashLiteralBraces:
134
+ Enabled: false
135
+
136
+ Metrics/ModuleLength:
137
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.3.0] - 2026-03-25
2
+ ### Changed
3
+ - Removed support for `Ruby` versions older than 3.3
4
+ ### Removed
5
+ - Remove support for passing a block to the step method through `DSLMethods#step`
6
+ - Remove support for passing a block to the step method through `DSLMethods#set`
7
+ - Remove support for `DSLMethods#map`
8
+
9
+ ## [1.2.0] - 2025-11-16
10
+ ### Deprecated
11
+ - Deprecate passing a block to the step method through `DSLMethods#step`
12
+ - Deprecate passing a block to the step method through `DSLMethods#set`
13
+ - Deprecate `DSLMethods#map`
14
+ ### Changed
15
+ - Removed deprecated `:auto_wire_options` option from `:dry_validation` plugin
16
+
1
17
  ## [1.1.0] - 2025-05-30
2
18
  ### Added
3
19
  - Added `:if` and `:unless` options for `:transaction` and `:after_commit` methods at `:sequel_models` plugin
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in pathway.gemspec
data/Rakefile CHANGED
@@ -3,10 +3,6 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
5
 
6
- RSpec::Core::RakeTask.new(:spec) do |t|
7
- unless RUBY_VERSION =~ /^2\.7|^3\./
8
- t.exclude_pattern = 'spec/operation_call_pattern_matching_spec.rb,spec/state_pattern_matching_spec.rb'
9
- end
10
- end
6
+ RSpec::Core::RakeTask.new(:spec)
11
7
 
12
8
  task :default => :spec
data/bin/bundle CHANGED
@@ -41,7 +41,7 @@ m = Module.new do
41
41
  gemfile = ENV["BUNDLE_GEMFILE"]
42
42
  return gemfile if gemfile && !gemfile.empty?
43
43
 
44
- File.expand_path("../.ruby-lsp/Gemfile", __dir__)
44
+ File.expand_path("../Gemfile", __dir__)
45
45
  end
46
46
 
47
47
  def lockfile
data/bin/byebug CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/coderay CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/htmldiff CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/ldiff CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/pry CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/racc ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'racc' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("racc", "racc")
data/bin/rake CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/rspec CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/rubocop ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("rubocop", "rubocop")
data/bin/ruby-parse ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-parse' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("parser", "ruby-parse")
data/bin/ruby-rewrite ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ruby-rewrite' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("parser", "ruby-rewrite")
data/bin/sequel CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/yard CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/yardoc CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
data/bin/yri CHANGED
@@ -8,7 +8,7 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../.ruby-lsp/Gemfile", __dir__)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
12
 
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
@@ -8,10 +8,10 @@ module Pathway
8
8
 
9
9
  def _callable(callable)
10
10
  if callable.is_a?(Symbol) && @operation.respond_to?(callable, true) &&
11
- @operation.method(callable).arity != 0 &&
12
- @operation.method(callable).parameters.all? { _1 in [:key|:keyreq|:keyrest|:block,*] }
11
+ @operation.method(callable).arity != 0 &&
12
+ @operation.method(callable).parameters.all? { _1 in [:key | :keyreq | :keyrest | :block, *] }
13
13
 
14
- -> state { @operation.send(callable, **state) }
14
+ ->(state) { @operation.send(callable, **state) }
15
15
  else
16
16
  super
17
17
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/validation'
3
+ require "dry/validation"
4
4
 
5
5
  module Pathway
6
6
  module Plugins
@@ -9,9 +9,6 @@ module Pathway
9
9
  attr_reader :contract_class, :contract_options
10
10
  attr_accessor :auto_wire
11
11
 
12
- alias_method :auto_wire_options, :auto_wire
13
- alias_method :auto_wire_options=, :auto_wire=
14
-
15
12
  def contract(base = nil, &)
16
13
  if block_given?
17
14
  base ||= _base_contract
@@ -19,7 +16,7 @@ module Pathway
19
16
  elsif base
20
17
  self.contract_class = base
21
18
  else
22
- raise ArgumentError, 'Either a contract class or a block must be provided'
19
+ raise ArgumentError, "Either a contract class or a block must be provided"
23
20
  end
24
21
  end
25
22
 
@@ -27,7 +24,7 @@ module Pathway
27
24
  contract { params(...) }
28
25
  end
29
26
 
30
- def contract_class= klass
27
+ def contract_class=(klass)
31
28
  @contract_class = klass
32
29
  @contract_options = (klass.dry_initializer.options - Dry::Validation::Contract.dry_initializer.options).map(&:target)
33
30
  @builded_contract = @contract_options.empty? && klass.schema ? klass.new : nil
@@ -53,14 +50,14 @@ module Pathway
53
50
  module InstanceMethods
54
51
  extend Forwardable
55
52
 
56
- delegate %i[build_contract contract_options auto_wire_options auto_wire] => 'self.class'
53
+ delegate %i[build_contract contract_options auto_wire] => "self.class"
57
54
  alias_method :contract, :build_contract
58
55
 
59
56
  def validate(state, with: nil)
60
57
  if auto_wire && contract_options.any?
61
58
  with ||= contract_options.zip(contract_options).to_h
62
59
  end
63
- opts = Hash(with).map { |to, from| [to, state[from]] }.to_h
60
+ opts = Hash(with).transform_values { |from| state[from] }
64
61
  validate_with(state[:input], **opts)
65
62
  .then { |params| state.update(params:) }
66
63
  end
@@ -72,13 +69,7 @@ module Pathway
72
69
  end
73
70
  end
74
71
 
75
- def self.apply(operation, auto_wire_options: (auto_wire_options_was_not_used=true; false), auto_wire: auto_wire_options)
76
- #:nocov:
77
- unless auto_wire_options_was_not_used
78
- warn "[DEPRECATION] `auto_wire_options` is deprecated. Please use `auto_wire` instead"
79
- end
80
- #:nocov:
81
-
72
+ def self.apply(operation, auto_wire: false)
82
73
  operation.auto_wire = auto_wire
83
74
  operation.contract_class = Dry::Validation::Contract
84
75
  end
@@ -4,9 +4,9 @@ module Pathway
4
4
  module Plugins
5
5
  module Responder
6
6
  module ClassMethods
7
- def call(*args, **kwargs, &bl)
8
- result = super(*args, **kwargs)
9
- block_given? ? Responder.respond(result, &bl) : result
7
+ def call(*, **, &)
8
+ result = super(*, **)
9
+ block_given? ? Responder.respond(result, &) : result
10
10
  end
11
11
  end
12
12
 
@@ -34,7 +34,7 @@ module Pathway
34
34
  def respond
35
35
  if @result.success?
36
36
  @context.instance_exec(@result.value, &@ok)
37
- elsif Error === @result.error && fail_block = @fails[@result.error.type]
37
+ elsif Error === @result.error && (fail_block = @fails[@result.error.type])
38
38
  @context.instance_exec(@result.error, &fail_block)
39
39
  else
40
40
  @context.instance_exec(@result.error, &@fail_default)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'sequel/model'
3
+ require "sequel/model"
4
4
 
5
5
  module Pathway
6
6
  module Plugins
@@ -32,9 +32,10 @@ module Pathway
32
32
 
33
33
  def _opts_if_unless(bg) = %i[if unless].map { bg.local_variable_get(_1) }
34
34
 
35
- def _with_db_steps(steps, step_name=nil, if_cond=nil, unless_cond=nil, &db_logic)
36
- raise ArgumentError, 'options :if and :unless are mutually exclusive' if if_cond && unless_cond
37
- raise ArgumentError, 'must provide either a step or a block but not both' if !!step_name == !!steps
35
+ def _with_db_steps(steps, step_name = nil, if_cond = nil, unless_cond = nil, &db_logic)
36
+ raise ArgumentError, "options :if and :unless are mutually exclusive" if if_cond && unless_cond
37
+ raise ArgumentError, "must provide either a step or a block but not both" if !step_name.nil? == !steps.nil?
38
+
38
39
  steps ||= proc { step step_name }
39
40
 
40
41
  if if_cond
@@ -69,15 +70,16 @@ module Pathway
69
70
 
70
71
  module InstanceMethods
71
72
  extend Forwardable
72
- delegate %i[model_class search_field model_not_found] => 'self.class'
73
- delegate :db => :model_class
74
73
 
75
- def fetch_model(state, from: model_class, search_by: search_field, using: search_by, to: result_key, overwrite: false, error_message: nil)
76
- error_message ||= if (from == model_class)
74
+ delegate %i[model_class search_field model_not_found] => "self.class"
75
+ delegate db: :model_class
76
+
77
+ def fetch_model(state, from: model_class, search_by: search_field, using: search_by, to: result_key, overwrite: false, error_message: nil) # rubocop:disable Metrics/ParameterLists
78
+ error_message ||= if from == model_class
77
79
  model_not_found
78
80
  elsif from.respond_to?(:name) || from.respond_to?(:model)
79
81
  from_name = (from.respond_to?(:name) ? from : from.model).name
80
- Inflector.humanize(Inflector.underscore(Inflector.demodulize(from_name))) + ' not found'
82
+ Inflector.humanize(Inflector.underscore(Inflector.demodulize(from_name))) + " not found"
81
83
  end
82
84
 
83
85
  if state[to].nil? || overwrite
@@ -94,8 +96,8 @@ module Pathway
94
96
  end
95
97
  end
96
98
 
97
- def self.apply(operation, model: nil, **kwargs)
98
- operation.model(model, **kwargs) if model
99
+ def self.apply(operation, model: nil, **)
100
+ operation.model(model, **) if model
99
101
  end
100
102
  end
101
103
  end