operations 0.6.2 → 0.6.3

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
2
  SHA256:
3
- metadata.gz: cc575adbf6fc2bf4be98c515a6339190ed29243ccccf2655a8927b0a8f95ac5a
4
- data.tar.gz: 486800ebcbd4bc7cffff7aa9e272dba34500a568911a23bb5c7ce60accbb7cea
3
+ metadata.gz: dc7557987e49805062efa789a9ecc5b0344839b5f8217b9a59fbd6904246ec8f
4
+ data.tar.gz: 801b5edbde46dba2c005ef8bad826691ca00ce7adda5654d04f602406d15847f
5
5
  SHA512:
6
- metadata.gz: 1998a83aa5e434c3431d43bf7036f674a2f5f1fd0859f0ea08fc24fe28c419c4a3ee42b07948d8d3faecb2b0b118d006119aa0818e03edd948292ff2e102222c
7
- data.tar.gz: b8fab83bfa1f14e139ec3b946f01496e22ec4a57243e74bcee354389e7818847b7df7bd9cd4cf66178e2bf247db1bccd9bd9d6bca12db6fb33b15bbcfb42f572
6
+ metadata.gz: bcec088edb29345af8934525274ddf100a5d0276545c2153ef1eeef4e6a255040dd0eabfd287afc5d68c3b041a4ac335ef8a258d653598cbb449eb2a78b94c63
7
+ data.tar.gz: b660a95428e98a9e6839f2b154623dd5226532c646a486f606f4c318c71bef8dd7861859a5775a28be47098ffeecd7c54974baaf31195246084d2ace7daeac08
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-03-25 07:19:50 UTC using RuboCop version 1.44.1.
3
+ # on 2023-12-20 10:30:23 UTC using RuboCop version 1.57.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -9,26 +9,20 @@
9
9
  # Offense count: 3
10
10
  # Configuration parameters: EnforcedStyle, AllowedGems, Include.
11
11
  # SupportedStyles: Gemfile, gems.rb, gemspec
12
- # AllowedGems: bundler
13
12
  # Include: **/*.gemspec, **/Gemfile, **/gems.rb
14
13
  Gemspec/DevelopmentDependencies:
15
14
  Exclude:
16
15
  - 'operations.gemspec'
17
16
 
18
17
  # Offense count: 5
19
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
18
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
20
19
  Metrics/AbcSize:
21
20
  Max: 28
22
21
 
23
22
  # Offense count: 2
24
23
  # Configuration parameters: CountComments, CountAsOne.
25
24
  Metrics/ClassLength:
26
- Max: 160
27
-
28
- # Offense count: 7
29
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
30
- Metrics/MethodLength:
31
- Max: 17
25
+ Max: 161
32
26
 
33
27
  # Offense count: 1
34
28
  # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
data/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [0.6.2](https://github.com/BookingSync/operations/tree/main)
3
+ ## [0.6.3](https://github.com/BookingSync/operations/tree/main)
4
+
5
+ ### Fixes
6
+
7
+ - In some cases, `Operation::Command#form_class` was evaluated before `form_base` was evaluated [\#41](https://github.com/BookingSync/operations/pull/41) ([pyromaniac](https://github.com/pyromaniac))
8
+
9
+ ## [0.6.2]
4
10
 
5
11
  ### Added
6
12
 
7
- - Support Rails 7.1 [\#40](https://github.com/BookingSync/operations/pull/40) ([ston1x](https://github.com/pyromaniac))
13
+ - Support Rails 7.1 [\#40](https://github.com/BookingSync/operations/pull/40) ([pyromaniac](https://github.com/pyromaniac))
8
14
  - Include `Dry::Monads[:result]` in Policies, Preconditions and Callbacks [\#39](https://github.com/BookingSync/operations/pull/39) ([ston1x](https://github.com/ston1x))
9
15
  - Add `callback` method to `Operations::Convenience` [\#37](https://github.com/BookingSync/operations/pull/37) ([pyromaniac](https://github.com/pyromaniac))
10
16
  - Ability to access operation result in callbacks [\#36](https://github.com/BookingSync/operations/pull/36) ([pyromaniac](https://github.com/pyromaniac))
@@ -165,7 +165,7 @@ class Operations::Command
165
165
  Operations::Types::String
166
166
  ), default: proc { {} }
167
167
  option :form_base, Operations::Types::Class, default: proc { ::Operations::Form }
168
- option :form_class, Operations::Types::Class, default: proc { build_form }
168
+ option :form_class, Operations::Types::Class.optional, default: proc {}
169
169
  option :form_hydrator, Operations::Types.Interface(:call), default: proc { FORM_HYDRATOR }
170
170
  option :configuration, Operations::Configuration, default: proc { Operations.default_config }
171
171
 
@@ -203,6 +203,7 @@ class Operations::Command
203
203
 
204
204
  preconditions.push(precondition) if precondition.present?
205
205
  super(operation, preconditions: preconditions, on_success: after, **options)
206
+ @form_class ||= build_form_class
206
207
  end
207
208
 
208
209
  # Instantiates a new command with the given fields updated.
@@ -264,7 +265,7 @@ class Operations::Command
264
265
  # These 3 methods added for convenience. They return boolean result
265
266
  # instead of Operations::Result. True on success and false on failure.
266
267
  %i[callable allowed possible].each do |method|
267
- define_method "#{method}?" do |**kwargs|
268
+ define_method :"#{method}?" do |**kwargs|
268
269
  public_send(method, **kwargs).success?
269
270
  end
270
271
  end
@@ -395,7 +396,7 @@ class Operations::Command
395
396
  end
396
397
  end
397
398
 
398
- def build_form
399
+ def build_form_class
399
400
  ::Operations::Form::Builder
400
401
  .new(base_class: form_base)
401
402
  .build(
@@ -80,7 +80,7 @@ module Operations::Convenience
80
80
  contract = Class.new(from)
81
81
  contract.config.messages.namespace = name.underscore
82
82
  contract.class_eval(&block)
83
- const_set("#{prefix.to_s.camelize}Contract", contract)
83
+ const_set(:"#{prefix.to_s.camelize}Contract", contract)
84
84
  end
85
85
 
86
86
  %w[policy precondition callback].each do |kind|
@@ -96,7 +96,7 @@ module Operations::Convenience
96
96
 
97
97
  klass.define_method(:call, &block) if block
98
98
 
99
- const_set("#{prefix.to_s.camelize}#{kind.camelize}", klass)
99
+ const_set(:"#{prefix.to_s.camelize}#{kind.camelize}", klass)
100
100
  end
101
101
  end
102
102
  end
@@ -52,7 +52,7 @@ class Operations::Form::Builder
52
52
  nested_attributes_suffix,
53
53
  nested_attributes_collection
54
54
  )
55
- form.define_method "#{hash_key.name}=", proc { |attributes| attributes } if nested_attributes_suffix
55
+ form.define_method :"#{hash_key.name}=", proc { |attributes| attributes } if nested_attributes_suffix
56
56
 
57
57
  key_path = path + [name]
58
58
  nested_form = traverse(members, form, name.underscore.camelize, model_map, key_path)
@@ -157,7 +157,7 @@ class Operations::Form
157
157
  name = name.to_sym
158
158
  return unless self.class.attributes.key?(name)
159
159
 
160
- nested_name = "#{name}_attributes".to_sym
160
+ nested_name = :"#{name}_attributes"
161
161
  value = data.key?(nested_name) ? data[nested_name] : data[name]
162
162
 
163
163
  (@attributes_cache ||= {})[name] ||= yield(value, self.class.attributes[name])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Operations
4
- VERSION = "0.6.2"
4
+ VERSION = "0.6.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: operations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkadiy Zabazhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.3.26
209
+ rubygems_version: 3.4.7
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Operations framework