aasm 5.4.0 → 5.5.1

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: 7d206aa3c586ccaa0d24a9096e78bf0fbb8a80b4e981538a7e1b016a389e8edc
4
- data.tar.gz: 64f6da6f80a5f7e76aed9cc422c9c401fa62ba30f02493e24d78caf58a6a4de2
3
+ metadata.gz: 6452e7ee0cefb2775eef585093aa60d6869ae19c1d22fa1d9d0243fa664a7f8a
4
+ data.tar.gz: 8d31d6bce9319012d2927b27b81813e6f94198ca7f2b0e5c22cc97bef8e5b257
5
5
  SHA512:
6
- metadata.gz: 0d1f425fa7bdf12b633f97621e28d0376c1582bb2cc131d96a9c7d1df1550e2c68a9019e7a28d5c56fa6fa9099ce4a021d5b1e6003ccfb364125688f78ea4f4a
7
- data.tar.gz: 78819143fc5c9bf3d52ec545a9a8d2ab174bbff1ac4eb3ff38e4a49524654c24aa585c43b9f9e39440284612b8a72913927ebb3eb0fd7392ca197270fd02ad9f
6
+ metadata.gz: 30f9259fadfc3dd34ee894ab44a49d6c336a23cd9e309cf2b9c6671fd105e2083d47a5dd4995a641023f1f34e0518b3af4c3879a8ee5913788343d61f82ccd8a
7
+ data.tar.gz: 395f496835b2d75df503fdc9bc706aa69297140a863a5d50a9f9ce2ea424bdfb9496dd097adb8af442f23e21ca00f5efa38b13befca1ac99a6be108cff3dd5b3
data/CHANGELOG.md ADDED
@@ -0,0 +1,484 @@
1
+ # CHANGELOG
2
+
3
+ ## unreleased
4
+
5
+ ## 5.5.1 (14 June 2025)
6
+ * Fix broken for pull requests, thanks @y-yago [#868](https://github.com/aasm/aasm/pull/868)
7
+ * Add build for Rails 8.0, thanks @y-yago [#860](https://github.com/aasm/aasm/pull/860)
8
+ * Fix issue around keyword arguments for Ruby 3.2, thanks @thiagofm [#857](https://github.com/aasm/aasm/pull/857)
9
+ * Add build for Rails 7.2, thanks @y-yago [#853](https://github.com/aasm/aasm/pull/853)
10
+ * Fix broken tests on Rails 7.1, thanks @y-yago [#842](https://github.com/aasm/aasm/pull/842)
11
+
12
+ ## 5.5.0
13
+ * Fix ClassInvoker instantiating class twice, thanks to [danielnolan](https://github.com/danielnolan)
14
+ * Replace File.exists? with File.exist?, thanks to [kyoshidajp](https://github.com/kyoshidajp)
15
+
16
+ ## 5.4.0
17
+ * Shrink gem size and export only needed files to work [#742](https://github.com/aasm/aasm/pull/742), thanks to [brunoarueira](https://github.com/brunoarueira)
18
+ * Lock redis-objects to 1.6.0 as 1.7.0 has breaking changes [#796](https://github.com/aasm/aasm/pull/796)
19
+ ## 5.3.1
20
+ * Fix fire! with string argument [#787](https://github.com/aasm/aasm/issues/787), in PR[#788](https://github.com/aasm/aasm/pull/788) thanks to [norman](https://github.com/norman)
21
+
22
+ * Allow `fire` and `fire!` to accept a String or Symbol for the event name, and raise AASM::UndefinedEvent rather than AASM::UndefinedState
23
+ when an event can not be found, thanks to [norman](https://github.com/norman).
24
+
25
+ ## 5.3.0
26
+
27
+ * Add Ruby 3.1 and Rails 7 to the CI matrix [#775](https://github.com/aasm/aasm/pull/775), thanks to [petergoldstein](https://github.com/petergoldstein)
28
+ * Fixed an error in Ruby 3 when specifying a method that takes keyword arguments, such as event's before hook [#777](https://github.com/aasm/aasm/pull/777), thanks to [pocari](https://github.com/pocari)
29
+ * Fix multi-threading bug not firing success callbacks [#778](https://github.com/aasm/aasm/pull/778), thanks to [guewen](https://github.com/guewen)
30
+ * Raise AASM::UndefinedState when calling fire or fire! with undefined event names [#753](https://github.com/aasm/aasm/pull/753), thanks to [danielvdao](https://github.com/danielvdao)
31
+ * Fixing Readme typos [#745](https://github.com/aasm/aasm/pull/745) [#772](https://github.com/aasm/aasm/pull/772) [#774](https://github.com/aasm/aasm/pull/774) [#781](https://github.com/aasm/aasm/pull/781), thanks to [jaredsmithse](https://github.com/jaredsmithse) [jcat4](https://github.com/jcat4) [ChandanChainani](https://github.com/ChandanChainani) [TessHuelskamp](https://github.com/TessHuelskamp)
32
+ * Add github actions config [#750](https://github.com/aasm/aasm/pull/750), thanks to [aka47](https://github.com/aka47)
33
+ * Test against for Rails 6.0 and improve ci [#719](https://github.com/aasm/aasm/pull/719), thanks to [yujideveloper](https://github.com/yujideveloper)
34
+ * Fix migration class name to work with zeitwerk [#720](https://github.com/aasm/aasm/pull/720), thanks to [rwegrzyniak](https://github.com/rwegrzyniak)
35
+ ## 5.2.0
36
+
37
+ * fix: timestamp will work with named machine [#739](https://github.com/aasm/aasm/pull/739), thanks to [RolandStuder](https://github.com/RolandStuder)
38
+ * Create namespaced scopes in PR [#735](https://github.com/aasm/aasm/pull/735), thanks to [caiohsramos](https://github.com/caiohsramos)
39
+ * Fix multiple state machines example per class on README in PR [#732](https://github.com/aasm/aasm/pull/732), thanks to [RodrigoVitiello](https://github.com/RodrigoVitiello)
40
+ * Update version in recommendation to add after_commit_everywhere in PR [#729](https://github.com/aasm/aasm/pull/729), thanks to [Envek](https://github.com/Envek)
41
+ * Fix i18n Event translations failing [#721](https://github.com/aasm/aasm/issues/721) in PR [#723](https://github.com/aasm/aasm/pull/723), thanks to [the-spectator](https://github.com/the-spectator)
42
+ * Add documentation to the Readme about how parameters are handled in AASM events in PR [#722](https://github.com/aasm/aasm/pull/722), thanks to [dstuebe](https://github.com/dstuebe)
43
+ * Fix human_state cached across locales [#709](https://github.com/aasm/aasm/issues/709) in PR [716](https://github.com/aasm/aasm/pull/716), thanks to [the-spectator](https://github.com/the-spectator)
44
+ * Relocate DslHelper from root namespace to under AASM namespace in PR [#711](https://github.com/aasm/aasm/pull/711) thank to [yujideveloper ](https://github.com/yujideveloper )
45
+ * Document how to define transitions from any state in in PR [#699](https://github.com/aasm/aasm/pull/699) thanks to [hedgesky](https://github.com/hedgesky)
46
+ * Add simple option for auto-generated timestamps in PR [#677](https://github.com/aasm/aasm/pull/677), thanks to [jaynetics](https://github.com/jaynetics)
47
+ ## 5.1.1
48
+
49
+ * Fix Depreciation message for after_commit_everywhere [#695](https://github.com/aasm/aasm/issues/695) in PR [#696](https://github.com/aasm/aasm/pull/696)
50
+ * Fix human_state to use display option [#684](https://github.com/aasm/aasm/issues/684) in PR [#697](https://github.com/aasm/aasm/pull/697)
51
+ * Remove support for ruby 2.3
52
+
53
+ ## 5.1.0
54
+
55
+ * Fix after_commit in nested transactions [#536](https://github.com/aasm/aasm/issues/536) without explicit AR dependency in PR [#668](https://github.com/aasm/aasm/pull/668), thanks to [stokarenko](https://github.com/stokarenko)
56
+ * Remove support for Rails 3.2
57
+
58
+ ## 5.0.8
59
+
60
+ * Revert Fix for :after_commit within nested transaction because it adds after_commit_action dependency which is dependent on many gems.
61
+
62
+ ## 5.0.7
63
+
64
+ * Fix :after_commit within nested transaction [#666](https://github.com/aasm/aasm/pull/666), thanks to [stokarenko](https://github.com/stokarenko)
65
+ * Add permitted_transitions to group permitted event with state [#664](https://github.com/aasm/aasm/pull/664), thanks to [dnamsons](https://github.com/dnamsons)
66
+ * Add Ruby 2.7.0 & 2.6.5 to Travis CI Test Matrix [#661](https://github.com/aasm/aasm/pull/661), thanks to [the-spectator](https://github.com/the-spectator)
67
+ * Handle InvalidTransition in transition_from matcher [#653](https://github.com/aasm/aasm/pull/653), thanks to [ryanwood](https://github.com/ryanwood)
68
+
69
+ ## 5.0.6
70
+
71
+ * Fix no_direct_assignment, couldn't be turned off pragmatically [#636](https://github.com/aasm/aasm/issues/636)
72
+ * Add instance level validation skip option [#644](https://github.com/aasm/aasm/pull/644), thanks to [Nitin-Salunke](https://github.com/Nitin-Salunke)
73
+ * Fixed aasm.current_event incorrectly yields nil when calling aasm.fire!(:event) [#551](https://github.com/aasm/aasm/issues/551) in [#638](https://github.com/aasm/aasm/pull/638), thanks to [DoubleJarvis](https://github.com/DoubleJarvis)
74
+ * Code Refactor [#634](https://github.com/aasm/aasm/pull/634) , thanks to [rahulknojha](https://github.com/rahulknojha)
75
+ * Fixed callback argument for :before_success & :success callback, [#630](https://github.com/aasm/aasm/pull/630)
76
+
77
+ ## 5.0.5
78
+
79
+ * Independent of ActiveSupport methods, [#627](https://github.com/aasm/aasm/pull/627),
80
+ thanks to [tristandruyen](https://github.com/tristandruyen). Fixes [#508](https://github.com/aasm/aasm/issues/508)
81
+
82
+ ## 5.0.4
83
+
84
+ * Specify dynamoid version for Rails > 5, [#625](https://github.com/aasm/aasm/pull/625),
85
+ thanks to [waghanza](https://github.com/waghanza)
86
+ * Add travis runner for Rails 5.2, [#624](https://github.com/aasm/aasm/pull/624), thanks
87
+ to [waghanza](https://github.com/waghanza)
88
+ * Cleanup Abstract class issue, [#620](https://github.com/aasm/aasm/pull/620), thanks to
89
+ [dennym](https://github.com/dennym)
90
+
91
+ ## 5.0.3
92
+
93
+ * Fix Abstract class issue, [#619](https://github.com/aasm/aasm/pull/619)
94
+
95
+ ## 5.0.2
96
+
97
+ * Clear failed callbacks, [#600](https://github.com/aasm/aasm/pull/600), thanks to
98
+ [nedgar](https://github.com/nedgar)
99
+ * README improvements, [#594](https://github.com/aasm/aasm/pull/594),
100
+ [#589](https://github.com/aasm/aasm/pull/589), [#587](https://github.com/aasm/aasm/pull/587),
101
+ [#597](https://github.com/aasm/aasm/pull/597), thanks to [jackscotti](https://github.com/jackscotti), [krmbzds](https://github.com/krmbzds),
102
+ [zegomesjf](https://github.com/zegomesjf), [BKSpurgeon](https://github.com/BKSpurgeon)
103
+ * Update InvalidTransition to include state_machine_name [#592](https://github.com/aasm/aasm/pull/592), thanks to [a14m](https://github.com/a14m)
104
+ * Do not add migration if model and column already exists [#586](https://github.com/aasm/aasm/pull/586), thanks to [KiranJosh](https://github.com/KiranJosh)
105
+
106
+ ## 5.0.1
107
+
108
+ * Fix failures array in transition not being reset [#383](https://github.com/aasm/aasm/issues/383)
109
+ * Enable AASM scopes to be defined on abstract classes.
110
+
111
+ ## 5.0.0
112
+
113
+ * Chore(invokers): Refactor callback invokers, add class-callbacks support [#541](https://github.com/aasm/aasm/pull/541), thanks to [pandomic](https://github.com/pandomic)
114
+ * Add docker setup to readme
115
+ * Add support for Nobrainer (RethinkDB) [#522](https://github.com/aasm/aasm/pull/522), thanks to [zedtux](https://github.com/zedtux)
116
+ * Patch `allow_event` to accept event with custom arguments [#419](https://github.com/aasm/aasm/pull/419), thanks to [czhc](https://github.com/czhc)
117
+
118
+ ## 4.12.3
119
+
120
+ * Add to AASM fire(event) and fire!(event) methods [#494](https://github.com/aasm/aasm/pull/494), thanks to [slayer](https://github.com/slayer)
121
+ * Add `use_transactions` flag to persist changes to the database even when some error occurs. [#493](https://github.com/aasm/aasm/pull/493), thanks to Peter Lampesberger.
122
+
123
+ ## 4.12.2
124
+
125
+ * Fix guards parameter [#484](https://github.com/aasm/aasm/pull/484), thanks to [teohm](https://github.com/teohm)
126
+ * Make errors more inspectable [#452](https://github.com/aasm/aasm/pull/452), thanks to [flexoid](https://github.com/flexoid)
127
+ * Enable Dynamoid for Rails 5 [#483](https://github.com/aasm/aasm/pull/483), thanks to [focusshifter](https://github.com/focusshifter)
128
+
129
+ ## 4.12.1
130
+
131
+ * DRY-up Mongoid and ActiveRecord Persistence, Add Sequel transactions and locking [#475](https://github.com/aasm/aasm/pull/475), thanks to [@Aryk](https://github.com/Aryk)
132
+ * Add aliases for event methods [#476](https://github.com/aasm/aasm/pull/476), thanks to [@Aryk](https://github.com/Aryk)
133
+ * Support Minitest spec expectations [#387](https://github.com/aasm/aasm/pull/387), thanks to [@faragorn](https://github.com/faragorn)
134
+ ## 4.12.0
135
+
136
+ * Fix thread safe issue with concurrent-ruby gem [see [pull-request #422](https://github.com/aasm/aasm/pull/442), thanks to [@reidmorrison](https://github.com/reidmorrison)
137
+ * Drop Support for Mongo Mapper [see [pull-request #439](https://github.com/aasm/aasm/pull/439)], thanks to [@reidmorrison](https://github.com/reidmorrison)
138
+ * add :binding_event option to event [see [pull-request #438](https://github.com/aasm/aasm/pull/438)], thanks to [@leanhdaovn](https://github.com/leanhdaovn)
139
+ * fix: `skip_validation_on_save: true` for default_scope records, [see [pull-request #433](https://github.com/aasm/aasm/pull/433)], thanks to [@larissa](https://github.com/larissa)
140
+ * Deep clone state machine during inheritance so that state machines in child classes can be modified (see [pull-request #429](https://github.com/aasm/aasm/pull/429)), thanks to [@reidmorrison](https://github.com/reidmorrison) and [@Tybot204](https://github.com/Tybot204)
141
+ * add before_success callback for event (see [pull-request #422](https://github.com/aasm/aasm/pull/422)), thanks to [@timsly ](https://github.com/timsly)
142
+ * fix: multiple transitions in a single event with the same to and from states (see [issue #372](https://github.com/aasm/aasm/issues/372) and [issue #362](https://github.com/aasm/aasm/issues/362) for details, fixed with [pull-request #408](https://github.com/aasm/aasm/pull/408), thanks to [@dathanb](https://github.com/dathanb))
143
+ * fix: passing nil as a argument to callbacks (see [issue #404](https://github.com/aasm/aasm/issues/404) for details, fixed with [pull-request #406](https://github.com/aasm/aasm/pull/406), thanks to [@yogeshjain999](https://github.com/yogeshjain999))
144
+
145
+
146
+ ## 4.11.1
147
+
148
+ * fix: generator file name when using custom column name instead of
149
+ aasm_state (see [issue #398](https://github.com/aasm/aasm/pull/398) for details,
150
+ thanks to [@bastianwegge](https://github.com/bastianwegge))
151
+ * fix: Scopes when states are defined as a series of symbols (see [issue #397](https://github.com/aasm/aasm/pull/397) for details, thanks to [@evheny0](https://github.com/evheny0))
152
+ * fix: Multiple transition behavior when one of the transitions does not
153
+ have a "from" parameter (see [issue #392](https://github.com/aasm/aasm/issues/392) for details)
154
+ * fix: permissible states not respecting guard parameters (see [issue #388](https://github.com/aasm/aasm/issues/388)) with [pull-request #389](https://github.com/aasm/aasm/pull/389)
155
+
156
+ ## 4.11.0
157
+
158
+ * support `logger` configuration (see [issue #370](https://github.com/aasm/aasm/pull/370) for details, thanks to [@HoyaBoya](https://github.com/HoyaBoya))
159
+ * support configuration to let bang transitions fail if object is invalid (see [issue #366](https://github.com/aasm/aasm/pull/366) and [issue #262](https://github.com/aasm/aasm/issues/262) for details, thanks to [@Wildebeest](https://github.com/Wildebeest))
160
+
161
+
162
+ ## 4.10.1
163
+
164
+ * fix: suppress warnings when using ActiveRecord enums feature (see [issue #346](https://github.com/aasm/aasm/pull/346) for details, thanks to [@110y](https://github.com/110y), and [issue #353](https://github.com/aasm/aasm/pull/353) for details, thanks to [@nathanstitt](https://github.com/nathanstitt))
165
+ * fix: handle array of success callbacks for transitions properly (see [issue #363](https://github.com/aasm/aasm/pull/363) for details, thanks to [@shunichi](https://github.com/shunichi))
166
+ * support `permitted: false` for states and events query/inspection methods (see [issue #364](https://github.com/aasm/aasm/pull/364) for details, thanks to [@hspazio](https://github.com/hspazio))
167
+
168
+ ## 4.10.0
169
+
170
+ * fix: some issues with RubyMotion (see [issue #320](https://github.com/aasm/aasm/pull/320) and [issue #343](https://github.com/aasm/aasm/pull/343) for details, thanks to [@Infotaku](https://github.com/Infotaku))
171
+ * fix: transitions now work in dup'ed copies (see [issue #325](https://github.com/aasm/aasm/pull/325) which fixes [issue #273](https://github.com/aasm/aasm/pull/273) for details, thanks to [@lingceng](https://github.com/lingceng))
172
+ * fix: allow skipping the `aasm_ensure_initial_state` callback (see [issue #326](https://github.com/aasm/aasm/pull/326) for details, thanks to [@sineed](https://github.com/sineed))
173
+ * fix: has_many association helper works again for Mongoid (see [issue #333](https://github.com/aasm/aasm/pull/333) which fixes [issue #332](https://github.com/aasm/aasm/pull/332) for details, thanks to [@anilmaurya](https://github.com/anilmaurya))
174
+ * improve performance / refactor: load and run only code which is needed (see [issue #336](https://github.com/aasm/aasm/pull/336) for details, thanks to [@csmuc](https://github.com/csmuc))
175
+ * improve: warn when overriding an existing method (see [issue #340](https://github.com/aasm/aasm/pull/340) which fixes [issue #335](https://github.com/aasm/aasm/pull/335) for details, thanks to [@pirj](https://github.com/pirj))
176
+ * fix: correct error message (by not evaluating the current state lazily) (see [issue #341](https://github.com/aasm/aasm/pull/341) which fixes [issue #312](https://github.com/aasm/aasm/pull/312) for details, thanks to [@pirj](https://github.com/pirj))
177
+ * addition: support for Redis as persistence layer (see [issue #190](https://github.com/aasm/aasm/pull/190) for details, thanks to [@javajax](https://github.com/javajax))
178
+ * addition: support transition `:success` callbacks (see [issue #239](https://github.com/aasm/aasm/pull/239) which fixes [issue #236](https://github.com/aasm/aasm/pull/236) for details, thanks to [@brega](https://github.com/brega))
179
+ * addition: support for namespacing methods and state names (see [issue #259](https://github.com/aasm/aasm/pull/259) for details, thanks to [@allspiritseve](https://github.com/allspiritseve))
180
+ * addition: support for defining multiple states in one line (see [issue #288](https://github.com/aasm/aasm/pull/288) which fixes [issue #146](https://github.com/aasm/aasm/pull/146) for details, thanks to [@HParker](https://github.com/HParker))
181
+ * fix: uninitialised constant when running Rails generator (see [issue #339](https://github.com/aasm/aasm/pull/339) for details, thanks to [@long-long-float](https://github.com/long-long-float))
182
+
183
+ ## 4.9.0
184
+
185
+ * add support for callback classes (`after` only) (see [issue #316](https://github.com/aasm/aasm/pull/316) for details, thanks to [@mlr](https://github.com/mlr))
186
+ * allow easier extension of _AASM_ (utilising the idea of _ApplicationRecords_ from _Rails 5_) (see [issue #296](https://github.com/aasm/aasm/pull/296) for details, thanks to [@mlr](https://github.com/mlr))
187
+ * support pessimistic locking for _ActiveRecord_ (see [issue #283](https://github.com/aasm/aasm/pull/283) for details, thanks to [@HoyaBoya](https://github.com/HoyaBoya))
188
+ * fix: support database sharding for _ActiveRecord_ (see [issue #289](https://github.com/aasm/aasm/pull/289) for details, thanks to [@scambra](https://github.com/scambra))
189
+ * fix: some issues with RubyMotion (see [issue #318](https://github.com/aasm/aasm/pull/318) for details, thanks to [@Infotaku](https://github.com/Infotaku))
190
+ * fix: Rails generator now features the correct namespace (see [issue #328](https://github.com/aasm/aasm/pull/328) and [issue #329](https://github.com/aasm/aasm/pull/329) for details, thanks to [@anilmaurya](https://github.com/anilmaurya))
191
+
192
+
193
+ ## 4.8.0
194
+
195
+ * add support for [dynamoid](http://joshsymonds.com/Dynamoid/) (see [issue #300](https://github.com/aasm/aasm/pull/300) for details, thanks to [@LeeChSien](https://github.com/LeeChSien))
196
+ * make compatible with [RubyMotion](http://www.rubymotion.com) (see [issue #315](https://github.com/aasm/aasm/pull/315) for details, thanks to [@Infotaku](https://github.com/Infotaku))
197
+ * improve error handling in case of an exception during transitioning (see [issue #275](https://github.com/aasm/aasm/pull/275) for details, thanks to [@chriswoodrich](https://github.com/chriswoodrich))
198
+ * rspec matcher `on_event` now supports arguments (see [issue #309](https://github.com/aasm/aasm/pull/309) for details, thanks to [@zacviandier](https://github.com/zacviandier))
199
+ * fix: permitted states now respect guards (see [issue #308](https://github.com/aasm/aasm/pull/308) for details, thanks to [@eebs](https://github.com/eebs))
200
+ * fix: reloading the env now doesn't add callbacks twice anymore (see [issue #311](https://github.com/aasm/aasm/pull/311) for details, thanks to [@lingceng](https://github.com/lingceng))
201
+
202
+ ## 4.7.0
203
+
204
+ * fix: allow :send as event name (see [issue #257](https://github.com/aasm/aasm/issues/257) for details)
205
+ * add new callbacks: transactions, all events, ensure (see [issue #282](https://github.com/aasm/aasm/issues/282) for details, thanks to [@HoyaBoya](https://github.com/HoyaBoya))
206
+
207
+ ## 4.6.0
208
+
209
+ * fix: make sure the column is actually present for _ActiveRecord_ enums (see [issue #265](https://github.com/aasm/aasm/issues/265) and [issue #152](https://github.com/aasm/aasm/issues/152) for details, thanks to [@anilmaurya](https://github.com/anilmaurya))
210
+ * add generators to configure active_record and mongoid after install (see [issue #261](https://github.com/aasm/aasm/issues/261) for details, thanks to [@anilmaurya](https://github.com/anilmaurya))
211
+
212
+ ## 4.5.2
213
+
214
+ * fix arity difference between Procs and lambdas (see [issue #293](https://github.com/aasm/aasm/issues/293) for details)
215
+
216
+ ## 4.5.1
217
+
218
+ * make sure to use override configuration options if state machine is defined more than once (see [issue #287](https://github.com/aasm/aasm/issues/287) for details)
219
+
220
+ ## 4.5.0
221
+
222
+ * add RSpec matchers `have_state`, `allow_event` and `allow_transition_to` (see [issue #147](https://github.com/aasm/aasm/issues/147) for details)
223
+ * add RSpec matcher `transition_from` (see [issue #178](https://github.com/aasm/aasm/issues/178) for details, thanks to [@thomasstephane](https://github.com/thomasstephane))
224
+
225
+ ## 4.4.1
226
+
227
+ * add support for rejecting certain events on inspection (see [issue #272](https://github.com/aasm/aasm/issues/272) for details, thanks to [@dubroe](https://github.com/dubroe))
228
+
229
+ ## 4.4.0
230
+
231
+ * add support global transation callbacks (see [issue #221](https://github.com/aasm/aasm/issues/221) and [issue #253](https://github.com/aasm/aasm/issues/253) for details)
232
+ * add support (bugfix) for Mongoid >= 5.0 (see [issue #277](https://github.com/aasm/aasm/issues/277) and [issue #278](https://github.com/aasm/aasm/issues/278) for details)
233
+
234
+ ## 4.3.0
235
+
236
+ * add support for multiple state machines per class (see [issue #158](https://github.com/aasm/aasm/issues/158) and [issue #240](https://github.com/aasm/aasm/issues/240) for details)
237
+ * special thanks to [@evadne](https://github.com/evadne) for testing this feature, and providing comments and patches (see [issue #245](https://github.com/aasm/aasm/issues/245) for details)
238
+
239
+ ## 4.2.0
240
+
241
+ * support turning off and on the configuration option for `no_direct_assignment` (see [issue #223](https://github.com/aasm/aasm/issues/223) for details)
242
+ * event arguments are now passed to `:after_commit` callbacks as well (see [issue #238](https://github.com/aasm/aasm/pull/238), thanks to [@kuinak](https://github.com/kuinak))
243
+
244
+ ## 4.1.1
245
+
246
+ * support block notation for `:after_commit` event callbacks (see [issue #224](https://github.com/aasm/aasm/issues/224) for details)
247
+ * event arguments are now passed to state callbacks as well (not only to event callbacks) (see [issue #219](https://github.com/aasm/aasm/issues/219), thanks to [@tobithiel](https://github.com/tobithiel))
248
+ * `AASM::InvalidTransition` now references the current object (with the state machine) and the _AASM_ event name (see [issue #217](https://github.com/aasm/aasm/issues/217), thanks to [@awsmsrc](https://github.com/awsmsrc))
249
+ * bugfix: do not update unloaded state for [Sequel](http://sequel.jeremyevans.net/) (see [issue #218](https://github.com/aasm/aasm/issues/218), thanks to [@godfat](https://github.com/godfat))
250
+
251
+ ## 4.1.0
252
+
253
+ * bugfix: initialize the aasm state column after initialization of the _Mongoid_ instance (see [issue #206](https://github.com/aasm/aasm/issues/206), thanks to [@Shwetakale ](https://github.com/Shwetakale ))
254
+ * added support for mongomapper ORM (see [issue #203](https://github.com/aasm/aasm/issues/203), thanks to [@reidmorrison ](https://github.com/reidmorrison ))
255
+ * `aasm_column` has been removed. Use `aasm.attribute_name` instead
256
+ * `aasm_human_event_name` has been removed. Use `aasm.human_event_name` instead
257
+
258
+ ## 4.0.8
259
+
260
+ * bugfix: may_event_name? should return true or false only (see [issue #200](https://github.com/aasm/aasm/issues/200) for details)
261
+
262
+ ## 4.0.7
263
+
264
+ * bugfix: take private methods into account when checking for callbacks (see [issue #197](https://github.com/aasm/aasm/issues/197) for details)
265
+
266
+ ## 4.0.6
267
+
268
+ * bugfix: `false` is treated as uninitialised state (same as `nil`) (see [issue #195](https://github.com/aasm/aasm/issues/195) for details)
269
+ * bugfix: an event's `:error` callback now retrieves all arguments passed to the event (see [issue #196](https://github.com/aasm/aasm/issues/196) for details)
270
+
271
+ ## 4.0.5
272
+
273
+ * bugfix: initialize the aasm state column after initialization of the _ActiveRecord_ instance only if the attribute has been loaded (see [issue #193](https://github.com/aasm/aasm/issues/193) for details)
274
+
275
+ ## 4.0.4
276
+
277
+ * corrected callback order in README
278
+ * bugfix: initialize the aasm state column after initialization of the _ActiveRecord_ instance (see [issue #191](https://github.com/aasm/aasm/issues/191) for details)
279
+ * bugfix: avoid Rails autoloading conflicts (see [issue #137](https://github.com/aasm/aasm/issues/137) and [issue #139](https://github.com/aasm/aasm/issues/139) for details)
280
+
281
+ ## 4.0.3
282
+
283
+ * bugfix: fire guards only once per transition, part 2 (see [issue #187](https://github.com/aasm/aasm/issues/187) for details)
284
+ * `aasm_column` is deprecated. Use `aasm.attribute_name` instead
285
+
286
+ ## 4.0.2
287
+
288
+ * bugfix: really support block-guards (defined within a transition block) (see [issue #186](https://github.com/aasm/aasm/issues/186) for details)
289
+
290
+ ## 4.0.1
291
+
292
+ * fire guards only once per transition (see [issue #184](https://github.com/aasm/aasm/issues/184) for details)
293
+ * `aasm_human_event_name` is deprecated, use `aasm.human_event_name` instead
294
+
295
+ ## 4.0.0
296
+
297
+ * support `if` and `unless` guard syntax: (see [issue #179](https://github.com/aasm/aasm/issues/179) and [issue #181](https://github.com/aasm/aasm/issues/181)), thanks to [@bigtunacan](https://github.com/bigtunacan)
298
+ * may configure to not allow direct assignment for persisted AASM models (see [issue #53](https://github.com/aasm/aasm/issues/53))
299
+ * **DSL change**: callbacks don't require `to_state` parameter anymore, but still support it
300
+ (closing issues
301
+ [#11](https://github.com/aasm/aasm/issues/11),
302
+ [#58](https://github.com/aasm/aasm/issues/58) and
303
+ [#80](https://github.com/aasm/aasm/issues/80)
304
+ thanks to [@ejlangev](https://github.com/ejlangev))
305
+ * **DSL change**: `after_commit` hooks are now event-based (see [issue #112](https://github.com/aasm/aasm/issues/112))
306
+ * **DSL change**: event and state callbacks have been re-ordered; state callbacks are not run anymore if any guard fails
307
+ * **DSL change**: `:on_transition` renamed to `:after`
308
+ * **DSL change**: `:on_transition` renamed to `:after`
309
+ * **DSL change**: transition `:after` binding changed (see [issue #59](https://github.com/aasm/aasm/issues/59), thanks to [@stiff](https://github.com/stiff))
310
+ * **DSL change**: instance-based events inspection now returns event instances (instead of the event names as symbol)
311
+ * **DSL change**: instance-based permissible_events has been removed in favor or events(:permissible => true)
312
+ * **DSL change**: class-based events now returns a list of Event instances (instead of a hash with event names as keys)
313
+ * **DSL change**: renamed permissible states and events to permitted states events
314
+ * removed deprecated methods (mostly the ones prefixed with `aasm_`)
315
+
316
+ ## 3.4.0
317
+
318
+ * allow retrieving the current event (`aasm.current_event`) (see [issue #159](https://github.com/aasm/aasm/issues/159) and [issue #168](https://github.com/aasm/aasm/issues/168))
319
+
320
+ ## 3.3.3
321
+
322
+ * bugfix: support reloading development environment in Rails (see [issue #148](https://github.com/aasm/aasm/issues/148))
323
+
324
+ ## 3.3.2
325
+
326
+ * bugfix: avoid conflicts with `failed` and `fired` event names (see [issue #157](https://github.com/aasm/aasm/issues/157)), thanks to [@MichaelXavier](https://github.com/MichaelXavier)
327
+ * bugfix: not using transactions unless saving to the database (see [issue #162](https://github.com/aasm/aasm/issues/162) and [issue #164](https://github.com/aasm/aasm/issues/164)), thanks to [@roberthoner](https://github.com/roberthoner)
328
+ * bugfix: `after_commit` should only run if saving to the database (see [issue #151](https://github.com/aasm/aasm/issues/151)), thanks to [@ivantsepp](https://github.com/ivantsepp)
329
+
330
+ ## 3.3.1
331
+
332
+ * bugfix: permissible events will respect given `guards` (see [issue #150](https://github.com/aasm/aasm/issues/150))
333
+
334
+ ## 3.3.0
335
+
336
+ * support for Rails 4.1 enum fields (see [issue #124](https://github.com/aasm/aasm/issues/124), thanks to [@bkon](https://github.com/bkon))
337
+ * bugfix: allow lazy-evaluation for Rails 3 scopes (see [issue #144](https://github.com/aasm/aasm/issues/144), thanks to [@laurens](https://github.com/laurens))
338
+
339
+ ## 3.2.1
340
+
341
+ * bugfix: permissible_events and events did not contain events with an empty "from" transition (see [issue #140](https://github.com/aasm/aasm/issues/140) and [issue #141](https://github.com/aasm/aasm/issues/141), thanks to [@daniel-rikowski](https://github.com/daniel-rikowski))
342
+
343
+ ## 3.2.0
344
+
345
+ * support [Sequel](http://sequel.jeremyevans.net/) (see [issue #119](https://github.com/aasm/aasm/issues/119), thanks to [@godfat](https://github.com/godfat))
346
+ * may not fire an unknown event (see [issue #128](https://github.com/aasm/aasm/issues/128)
347
+
348
+ ## 3.1.1
349
+
350
+ * bugfix: don't require ActiveRecord for localizing AASM event and state name (see [issue #113](https://github.com/aasm/aasm/issues/113), thanks to [@silentshade](https://github.com/silentshade))
351
+
352
+ ## 3.1.0
353
+
354
+ * validating the current state (see [issue #95](https://github.com/aasm/aasm/issues/95), thanks to [@ivantsepp](https://github.com/ivantsepp))
355
+ * allow configuring behavior of nested transactions (see [issue #107](https://github.com/aasm/aasm/issues/107))
356
+ * support multiple guards per transition
357
+ * support event guards (see [issue #85](https://github.com/aasm/aasm/issues/85))
358
+ * support reading from- and to-state during on_transition callback (see [issue #100](https://github.com/aasm/aasm/issues/100))
359
+
360
+ ## 3.0.26
361
+
362
+ * support state.human_name (aliased to state.localized_name) (see [issue #105](https://github.com/aasm/aasm/issues/105))
363
+
364
+ ## 3.0.25
365
+
366
+ * initialize the state even if validation is skipped (for ActiveRecord and Mongoid persistence) (see [issue #103](https://github.com/aasm/aasm/issues/103), thanks to [@vfonic](https://github.com/vfonic) and [@aaronklaassen](https://github.com/aaronklaassen))
367
+
368
+ ## 3.0.24
369
+
370
+ * added support for event blocks (thanks to [@Intrepidd](https://github.com/Intrepidd))
371
+
372
+ ## 3.0.23
373
+
374
+ * added support for `after_commit` callback (transaction support) (thanks to [@tisba](https://github.com/tisba))
375
+
376
+ ## 3.0.22
377
+
378
+ * fixed [issue 88](https://github.com/aasm/aasm/issues/88): wrong number of arguments for transaction method
379
+
380
+ ## 3.0.21
381
+
382
+ * support nested ActiveRecord transactions ([@ozeias](https://github.com/ozeias))
383
+ * allow overwriting of events, can be very useful with inheritance ([@Intrepidd](https://github.com/Intrepidd))
384
+
385
+ ## 3.0.20
386
+
387
+ * added configuration option to disable automatic scope creation
388
+
389
+ ## 3.0.19
390
+
391
+ * fixed deprecation warning with *Rails 4* (`Relation#update_all` with conditions is deprecated)
392
+ * fixing [issue #69](https://github.com/aasm/aasm/issues/69) ( *ActiveRecord* scopes are not chainable)
393
+
394
+ ## 3.0.18
395
+
396
+ * fixing [issue #66](https://github.com/aasm/aasm/issues/66) (state methods not reflecting the current state)
397
+
398
+ ## 3.0.17
399
+
400
+ * supporting instance level inspection for states (including permissible state, see [issue #54](https://github.com/aasm/aasm/issues/54))
401
+ * added autocreation of constants for each state ([@jherdman](https://github.com/jherdman))
402
+
403
+ ## 3.0.16
404
+
405
+ * added autocreation of state scopes for Mongoid (thanks to [@jonnyshields](https://github.com/johnnyshields))
406
+
407
+ ## 3.0.15
408
+
409
+ * added support for localized state names (on a class level, like `Record.aasm.states.map(&:localized_name)`)
410
+
411
+ ## 3.0.14
412
+
413
+ * supporting event inspection for to-states transitions (`Event#transitions_to_state?`)
414
+
415
+ ## 3.0.13
416
+
417
+ * supporting *ActiveRecord* transactions when firing an event
418
+
419
+ ## 3.0.12
420
+
421
+ * `aasm_from_states_for_state` now supports to filter for specific transition
422
+
423
+ ## 3.0.11
424
+
425
+ * added class method `aasm_from_states_for_state` to retrieve all from states (regarding transitions) for a given state
426
+
427
+ ## 3.0.10
428
+
429
+ * added support for transitions from all other states (thanks to [@swrobel](https://github.com/swrobel))
430
+
431
+ ## 3.0.9
432
+
433
+ * guard checks (e.g. `may_edit?`) now support guard parameters as well
434
+
435
+ ## 3.0.8
436
+
437
+ * fixed issue with generating docs using yard
438
+
439
+ ## 3.0.7
440
+
441
+ * removed deprecation warning when localizing aasm state names (look at [issue #38](https://github.com/rubyist/aasm/issues/38) for details)
442
+
443
+ ## 3.0.6
444
+
445
+ * bugfix: if configured to skip validation the code does not validate anymore
446
+
447
+ ## 3.0.5
448
+
449
+ * bugfix: get rid of error with old rubygems versions
450
+
451
+ ## 3.0.4
452
+
453
+ * bugfix: Subclasses of aasm-enabled classes don't lose settings anymore (thanks to codez)
454
+
455
+ ## 3.0.3
456
+
457
+ * bugfix: ActiveRecord scopes are generated when using the new DSL
458
+
459
+ ## 3.0.2
460
+
461
+ * ActiveRecord persistence can ignore validation when trying to save invalid models
462
+
463
+ ## 3.0.1
464
+
465
+ * added support for Mongoid (Thanks, Michał Taberski)
466
+
467
+ ## 3.0.0
468
+
469
+ * switched documentation to the new DSL
470
+ * whiny transactions: by default, raise an exception if an event transition is not possible
471
+ * you may disable whiny transactions
472
+
473
+ ## 2.4.0
474
+
475
+ * supporting new DSL (which is much shorter)
476
+
477
+ ## 2.3.1
478
+
479
+ * bugfix: avoid naming conflict with i18n
480
+
481
+ ## 2.3.0
482
+
483
+ * supporting i18n
484
+ * supporting regular expressions for hash values and strings
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # AASM - Ruby state machines
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/aasm.svg)](http://badge.fury.io/rb/aasm)
4
- [![Build Status](https://travis-ci.org/aasm/aasm.svg?branch=master)](https://travis-ci.org/aasm/aasm)
4
+ [![Build Status](https://github.com/aasm/aasm/actions/workflows/build.yml/badge.svg)](https://github.com/aasm/aasm/actions/workflows/build.yml)
5
5
  [![Code Climate](https://codeclimate.com/github/aasm/aasm/badges/gpa.svg)](https://codeclimate.com/github/aasm/aasm)
6
6
  [![codecov](https://codecov.io/gh/aasm/aasm/branch/master/graph/badge.svg)](https://codecov.io/gh/aasm/aasm)
7
7
 
@@ -656,7 +656,7 @@ Let's suppose we have common logic across many AASM models. We can embody this l
656
656
 
657
657
  ```ruby
658
658
  class CustomAASMBase < AASM::Base
659
- # A custom transiton that we want available across many AASM models.
659
+ # A custom transition that we want available across many AASM models.
660
660
  def count_transitions!
661
661
  klass.class_eval do
662
662
  aasm with_klass: CustomAASMBase do
@@ -1481,7 +1481,6 @@ Feel free to
1481
1481
 
1482
1482
  * [create an issue on GitHub](https://github.com/aasm/aasm/issues)
1483
1483
  * [ask a question on StackOverflow](http://stackoverflow.com) (tag with `aasm`)
1484
- * send us a tweet [@aasm](http://twitter.com/aasm)
1485
1484
 
1486
1485
  ## Maintainers ##
1487
1486
 
@@ -1490,8 +1489,6 @@ Feel free to
1490
1489
  * [Thorsten Böttger](http://github.com/alto) (since 2011)
1491
1490
  * [Anil Maurya](http://github.com/anilmaurya) (since 2016)
1492
1491
 
1493
-
1494
-
1495
1492
  ## Stargazers over time
1496
1493
 
1497
1494
  [![Stargazers over time](https://starchart.cc/aasm/aasm.svg)](https://starchart.cc/aasm/aasm)
@@ -69,6 +69,16 @@ module AASM
69
69
  def invoke_subject
70
70
  raise NoMethodError, '"#invoke_subject" is not implemented'
71
71
  end
72
+
73
+ ##
74
+ # Parse arguments to separate keyword arguments from positional arguments
75
+ def parse_arguments
76
+ if args.last.is_a?(Hash)
77
+ [args[0..-2], args.last]
78
+ else
79
+ [args, nil]
80
+ end
81
+ end
72
82
  end
73
83
  end
74
84
  end
@@ -17,7 +17,7 @@ module AASM
17
17
  end
18
18
 
19
19
  def invoke_subject
20
- @result = retrieve_instance.call
20
+ @result = instance.call
21
21
  end
22
22
 
23
23
  private
@@ -34,14 +34,37 @@ module AASM
34
34
  @instance ||= retrieve_instance
35
35
  end
36
36
 
37
- # rubocop:disable Metrics/AbcSize
38
37
  def retrieve_instance
39
38
  return subject.new if subject_arity.zero?
40
39
  return subject.new(record) if subject_arity == 1
41
- return subject.new(record, *args) if subject_arity < 0
40
+
41
+ if keyword_arguments?
42
+ instance_with_keyword_args
43
+ elsif subject_arity < 0
44
+ subject.new(record, *args)
45
+ else
46
+ instance_with_fixed_arity
47
+ end
48
+ end
49
+
50
+ def keyword_arguments?
51
+ params = subject.instance_method(:initialize).parameters
52
+ params.any? { |type, _| [:key, :keyreq].include?(type) }
53
+ end
54
+
55
+ def instance_with_keyword_args
56
+ positional_args, keyword_args = parse_arguments
57
+
58
+ if keyword_args.nil?
59
+ subject.new(record, *positional_args)
60
+ else
61
+ subject.new(record, *positional_args, **keyword_args)
62
+ end
63
+ end
64
+
65
+ def instance_with_fixed_arity
42
66
  subject.new(record, *args[0..(subject_arity - 2)])
43
67
  end
44
- # rubocop:enable Metrics/AbcSize
45
68
 
46
69
  def subject_arity
47
70
  @arity ||= subject.instance_method(:initialize).arity
@@ -25,14 +25,57 @@ module AASM
25
25
  @arity ||= record.__send__(:method, subject.to_sym).arity
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/AbcSize
29
28
  def exec_subject
29
+ ensure_method_exists
30
+ return simple_invoke if subject_arity.zero?
31
+ invoke_with_arguments
32
+ end
33
+
34
+ def ensure_method_exists
30
35
  raise(*record_error) unless record.respond_to?(subject, true)
31
- return record.__send__(subject) if subject_arity.zero?
32
- return record.__send__(subject, *args) if subject_arity < 0
33
- record.__send__(subject, *args[0..(subject_arity - 1)])
34
36
  end
35
- # rubocop:enable Metrics/AbcSize
37
+
38
+ def simple_invoke
39
+ record.__send__(subject)
40
+ end
41
+
42
+ def invoke_with_arguments
43
+ if keyword_arguments?
44
+ instance_with_keyword_args
45
+ elsif subject_arity < 0
46
+ invoke_with_variable_arity
47
+ else
48
+ invoke_with_fixed_arity
49
+ end
50
+ end
51
+
52
+ def keyword_arguments?
53
+ params = record.method(subject).parameters
54
+ params.any? { |type, _| [:key, :keyreq].include?(type) }
55
+ end
56
+
57
+ def instance_with_keyword_args
58
+ positional_args, keyword_args = parse_arguments
59
+
60
+ if keyword_args.nil?
61
+ record.send(subject, *positional_args)
62
+ else
63
+ record.send(subject, *positional_args, **keyword_args)
64
+ end
65
+ end
66
+
67
+ def invoke_with_variable_arity
68
+ record.__send__(subject, *args)
69
+ end
70
+
71
+ def invoke_with_fixed_arity
72
+ req_args = args[0..(subject_arity - 1)]
73
+ if req_args[0].is_a?(Hash)
74
+ record.__send__(subject, **req_args[0])
75
+ else
76
+ record.__send__(subject, *req_args)
77
+ end
78
+ end
36
79
 
37
80
  def record_error
38
81
  [
data/lib/aasm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "5.4.0"
2
+ VERSION = "5.5.1"
3
3
  end
@@ -29,7 +29,7 @@ RUBY
29
29
  end
30
30
 
31
31
  def model_exists?
32
- File.exists?(File.join(destination_root, model_path))
32
+ File.exist?(File.join(destination_root, model_path))
33
33
  end
34
34
 
35
35
  def model_path
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.4.0
4
+ version: 5.5.1
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: 2022-10-07 00:00:00.000000000 Z
12
+ date: 2025-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -96,7 +96,7 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: simplecov
99
+ name: simplecov-cobertura
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
@@ -109,20 +109,6 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- - !ruby/object:Gem::Dependency
113
- name: codecov
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: 0.1.21
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: 0.1.21
126
112
  - !ruby/object:Gem::Dependency
127
113
  name: pry
128
114
  requirement: !ruby/object:Gem::Requirement
@@ -144,6 +130,7 @@ executables: []
144
130
  extensions: []
145
131
  extra_rdoc_files: []
146
132
  files:
133
+ - CHANGELOG.md
147
134
  - LICENSE
148
135
  - README.md
149
136
  - lib/aasm.rb
@@ -214,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
201
  - !ruby/object:Gem::Version
215
202
  version: '0'
216
203
  requirements: []
217
- rubygems_version: 3.0.3
204
+ rubygems_version: 3.5.22
218
205
  signing_key:
219
206
  specification_version: 4
220
207
  summary: State machine mixin for Ruby objects