aasm 5.5.1 → 5.5.2

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: 6452e7ee0cefb2775eef585093aa60d6869ae19c1d22fa1d9d0243fa664a7f8a
4
- data.tar.gz: 8d31d6bce9319012d2927b27b81813e6f94198ca7f2b0e5c22cc97bef8e5b257
3
+ metadata.gz: d595b30dbb66e3d0bc0f3f6109c6778855a847b7fd71aebcb825579b12c44a11
4
+ data.tar.gz: b91cefa8980e1ff097d2c4528a389c6e17e952b8d1d893f5f537c5a9c83b1248
5
5
  SHA512:
6
- metadata.gz: 30f9259fadfc3dd34ee894ab44a49d6c336a23cd9e309cf2b9c6671fd105e2083d47a5dd4995a641023f1f34e0518b3af4c3879a8ee5913788343d61f82ccd8a
7
- data.tar.gz: 395f496835b2d75df503fdc9bc706aa69297140a863a5d50a9f9ce2ea424bdfb9496dd097adb8af442f23e21ca00f5efa38b13befca1ac99a6be108cff3dd5b3
6
+ metadata.gz: 5956d4c90d2b6197eea0cb554560143c3f85477b800183d9008d5275ce6296e7d52c6d1d25dbdab928345d44e52520f9a509f2b1023f111ebae086803e28bf41
7
+ data.tar.gz: e53d39470364eec71f24ee1ab020fecf53328b4a4a1c7ae38dd5344b715ab6f0e912e847e593d6910dfad549c708a63f193f9dded66eb31a0c823835fd377b63
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## 5.5.2 (22 October 2025)
6
+ * Fix another issue around keyword arguments for Ruby >3.2, thanks @segiddins [#873](https://github.com/aasm/aasm/pull/873)
7
+ * Upgrade rails tests and move concurrent to load only necessary class, thanks @allcentury [#852](https://github.com/aasm/aasm/pull/852)
8
+ * Add changelog-uri, thanks @kzkn [#759](https://github.com/aasm/aasm/pull/759)
9
+
5
10
  ## 5.5.1 (14 June 2025)
6
11
  * Fix broken for pull requests, thanks @y-yago [#868](https://github.com/aasm/aasm/pull/868)
7
12
  * Add build for Rails 8.0, thanks @y-yago [#860](https://github.com/aasm/aasm/pull/860)
@@ -30,11 +30,40 @@ module AASM
30
30
  subject.respond_to?(:parameters)
31
31
  end
32
32
 
33
+ def keyword_arguments?
34
+ return false unless support_parameters?
35
+ subject.parameters.any? { |type, _| [:key, :keyreq].include?(type) }
36
+ end
37
+
38
+ def exec_proc_with_keyword_args(parameters_size)
39
+ positional_args, keyword_args = parse_arguments
40
+
41
+ if keyword_args.nil?
42
+ if parameters_size < 0
43
+ record.instance_exec(*positional_args, &subject)
44
+ else
45
+ record.instance_exec(*positional_args[0..(parameters_size - 1)], &subject)
46
+ end
47
+ else
48
+ if parameters_size < 0
49
+ record.instance_exec(*positional_args, **keyword_args, &subject)
50
+ else
51
+ record.instance_exec(*positional_args[0..(parameters_size - 1)], **keyword_args, &subject)
52
+ end
53
+ end
54
+ end
55
+
33
56
  # rubocop:disable Metrics/AbcSize
34
57
  def exec_proc(parameters_size)
35
- return record.instance_exec(&subject) if parameters_size.zero?
36
- return record.instance_exec(*args, &subject) if parameters_size < 0
37
- record.instance_exec(*args[0..(parameters_size - 1)], &subject)
58
+ return record.instance_exec(&subject) if parameters_size.zero? && !keyword_arguments?
59
+
60
+ if keyword_arguments?
61
+ exec_proc_with_keyword_args(parameters_size)
62
+ elsif parameters_size < 0
63
+ record.instance_exec(*args, &subject)
64
+ else
65
+ record.instance_exec(*args[0..(parameters_size - 1)], &subject)
66
+ end
38
67
  end
39
68
  # rubocop:enable Metrics/AbcSize
40
69
 
@@ -48,8 +77,14 @@ module AASM
48
77
 
49
78
  def parameters_to_arity
50
79
  subject.parameters.inject(0) do |memo, parameter|
51
- memo += 1
52
- memo *= -1 if parameter[0] == :rest && memo > 0
80
+ case parameter[0]
81
+ when :key, :keyreq
82
+ # Keyword arguments don't count towards positional arity
83
+ when :rest
84
+ memo = memo > 0 ? -memo : -1
85
+ else
86
+ memo += 1
87
+ end
53
88
  memo
54
89
  end
55
90
  end
@@ -1,4 +1,5 @@
1
- require 'concurrent'
1
+ require 'concurrent/map'
2
+
2
3
  module AASM
3
4
  class StateMachineStore
4
5
  @stores = Concurrent::Map.new
data/lib/aasm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "5.5.1"
2
+ VERSION = "5.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.1
4
+ version: 5.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thorsten Boettger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-06-14 00:00:00.000000000 Z
12
+ date: 2025-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -185,7 +185,8 @@ files:
185
185
  homepage: https://github.com/aasm/aasm
186
186
  licenses:
187
187
  - MIT
188
- metadata: {}
188
+ metadata:
189
+ changelog_uri: https://github.com/aasm/aasm/blob/master/CHANGELOG.md
189
190
  post_install_message:
190
191
  rdoc_options: []
191
192
  require_paths: