verborghs-state_machine 0.9.4

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.
Files changed (89) hide show
  1. data/CHANGELOG.rdoc +360 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +635 -0
  4. data/Rakefile +77 -0
  5. data/examples/AutoShop_state.png +0 -0
  6. data/examples/Car_state.png +0 -0
  7. data/examples/TrafficLight_state.png +0 -0
  8. data/examples/Vehicle_state.png +0 -0
  9. data/examples/auto_shop.rb +11 -0
  10. data/examples/car.rb +19 -0
  11. data/examples/merb-rest/controller.rb +51 -0
  12. data/examples/merb-rest/model.rb +28 -0
  13. data/examples/merb-rest/view_edit.html.erb +24 -0
  14. data/examples/merb-rest/view_index.html.erb +23 -0
  15. data/examples/merb-rest/view_new.html.erb +13 -0
  16. data/examples/merb-rest/view_show.html.erb +17 -0
  17. data/examples/rails-rest/controller.rb +43 -0
  18. data/examples/rails-rest/migration.rb +11 -0
  19. data/examples/rails-rest/model.rb +23 -0
  20. data/examples/rails-rest/view_edit.html.erb +25 -0
  21. data/examples/rails-rest/view_index.html.erb +23 -0
  22. data/examples/rails-rest/view_new.html.erb +14 -0
  23. data/examples/rails-rest/view_show.html.erb +17 -0
  24. data/examples/traffic_light.rb +7 -0
  25. data/examples/vehicle.rb +31 -0
  26. data/init.rb +1 -0
  27. data/lib/state_machine/assertions.rb +36 -0
  28. data/lib/state_machine/callback.rb +241 -0
  29. data/lib/state_machine/condition_proxy.rb +106 -0
  30. data/lib/state_machine/eval_helpers.rb +83 -0
  31. data/lib/state_machine/event.rb +267 -0
  32. data/lib/state_machine/event_collection.rb +122 -0
  33. data/lib/state_machine/extensions.rb +149 -0
  34. data/lib/state_machine/guard.rb +230 -0
  35. data/lib/state_machine/initializers/merb.rb +1 -0
  36. data/lib/state_machine/initializers/rails.rb +5 -0
  37. data/lib/state_machine/initializers.rb +4 -0
  38. data/lib/state_machine/integrations/active_model/locale.rb +11 -0
  39. data/lib/state_machine/integrations/active_model/observer.rb +45 -0
  40. data/lib/state_machine/integrations/active_model.rb +445 -0
  41. data/lib/state_machine/integrations/active_record/locale.rb +20 -0
  42. data/lib/state_machine/integrations/active_record.rb +522 -0
  43. data/lib/state_machine/integrations/data_mapper/observer.rb +175 -0
  44. data/lib/state_machine/integrations/data_mapper.rb +379 -0
  45. data/lib/state_machine/integrations/mongo_mapper.rb +309 -0
  46. data/lib/state_machine/integrations/sequel.rb +356 -0
  47. data/lib/state_machine/integrations.rb +83 -0
  48. data/lib/state_machine/machine.rb +1645 -0
  49. data/lib/state_machine/machine_collection.rb +64 -0
  50. data/lib/state_machine/matcher.rb +123 -0
  51. data/lib/state_machine/matcher_helpers.rb +54 -0
  52. data/lib/state_machine/node_collection.rb +152 -0
  53. data/lib/state_machine/state.rb +260 -0
  54. data/lib/state_machine/state_collection.rb +112 -0
  55. data/lib/state_machine/transition.rb +399 -0
  56. data/lib/state_machine/transition_collection.rb +244 -0
  57. data/lib/state_machine.rb +421 -0
  58. data/lib/tasks/state_machine.rake +1 -0
  59. data/lib/tasks/state_machine.rb +27 -0
  60. data/test/files/en.yml +9 -0
  61. data/test/files/switch.rb +11 -0
  62. data/test/functional/state_machine_test.rb +980 -0
  63. data/test/test_helper.rb +4 -0
  64. data/test/unit/assertions_test.rb +40 -0
  65. data/test/unit/callback_test.rb +728 -0
  66. data/test/unit/condition_proxy_test.rb +328 -0
  67. data/test/unit/eval_helpers_test.rb +222 -0
  68. data/test/unit/event_collection_test.rb +324 -0
  69. data/test/unit/event_test.rb +795 -0
  70. data/test/unit/guard_test.rb +909 -0
  71. data/test/unit/integrations/active_model_test.rb +956 -0
  72. data/test/unit/integrations/active_record_test.rb +1918 -0
  73. data/test/unit/integrations/data_mapper_test.rb +1814 -0
  74. data/test/unit/integrations/mongo_mapper_test.rb +1382 -0
  75. data/test/unit/integrations/sequel_test.rb +1492 -0
  76. data/test/unit/integrations_test.rb +50 -0
  77. data/test/unit/invalid_event_test.rb +7 -0
  78. data/test/unit/invalid_transition_test.rb +7 -0
  79. data/test/unit/machine_collection_test.rb +565 -0
  80. data/test/unit/machine_test.rb +2349 -0
  81. data/test/unit/matcher_helpers_test.rb +37 -0
  82. data/test/unit/matcher_test.rb +155 -0
  83. data/test/unit/node_collection_test.rb +207 -0
  84. data/test/unit/state_collection_test.rb +280 -0
  85. data/test/unit/state_machine_test.rb +31 -0
  86. data/test/unit/state_test.rb +848 -0
  87. data/test/unit/transition_collection_test.rb +2098 -0
  88. data/test/unit/transition_test.rb +1384 -0
  89. metadata +176 -0
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,360 @@
1
+ == master
2
+
3
+ == 0.9.4 / 2010-08-01
4
+
5
+ * Fix validation / save hooks in Sequel 3.14.0+
6
+ * Fix integration with dirty attribute tracking on DataMapper 1.0.1+
7
+ * Fix DataMapper 1.0.1+ tests producing warnings
8
+ * Fix validation error warnings in ActiveModel / ActiveRecord 3.0.0 beta5+
9
+ * Fix mass-assignment sanitization breaking in ActiveRecord 3.0.0 beta5+ [Akira Matsuda]
10
+
11
+ == 0.9.3 / 2010-06-26
12
+
13
+ * Allow access to human state / event names in transitions and for the current state
14
+ * Use human state / event names in error messages
15
+ * Fix event names being used inconsistently in error messages
16
+ * Allow access to the humanized version of state / event names via human_state_name / human_state_event_name
17
+ * Allow MongoMapper 0.8.0+ scopes to be chainable
18
+ * Fix i18n deprecation warnings in ActiveModel / ActiveRecord 3.0.0.beta4
19
+ * Fix default error message translations overriding existing locales in ActiveModel / ActiveRecord
20
+
21
+ == 0.9.2 / 2010-05-24
22
+
23
+ * Fix MongoMapper integration failing in Ruby 1.9.2
24
+ * Fix Rakefile not loading in Ruby 1.9.2 [Andrea Longhi]
25
+ * Fix nil / false :integration configuration not being respected
26
+
27
+ == 0.9.1 / 2010-05-02
28
+
29
+ * Fix ActiveRecord 2.0.0 - 2.2.3 integrations failing if version info isn't already loaded
30
+ * Fix integration with dirty attribute tracking on DataMapper 0.10.3
31
+ * Fix observers failing in ActiveRecord 3.0.0.beta4+ integrations
32
+ * Fix deprecation warning in Rails 3 railtie [Chris Yuan]
33
+
34
+ == 0.9.0 / 2010-04-12
35
+
36
+ * Use attribute-based event transitions whenever possible to ensure consistency
37
+ * Fix action helpers being defined when the action is *only* defined in the machine's owner class
38
+ * Disable attribute-based event transitions in DataMapper 0.9.4 - 0.9.6 when dm-validations is being used
39
+ * Add support for DataMapper 0.10.3+
40
+ * Add around_transition callbacks
41
+ * Fix transition failures during save not being handled correctly in Sequel 2.12.0+
42
+ * Fix attribute-based event transitions not hooking in properly in DataMapper 0.10.0+ and Sequel 2.12.0+
43
+ * Fix dynamic initial states causing errors in Ruby 1.9+ if no arguments are defined in the block
44
+ * Add MongoMapper 0.5.5+ support
45
+ * Add ActiveModel 3.0+ support for use with integrations that implement its interface
46
+ * Fix DataMapper integration failing when ActiveSupport is loaded in place of Extlib
47
+ * Add version dependencies for ruby-graphviz
48
+ * Remove app-specific rails / merb rake tasks in favor of always running state_machine:draw
49
+ * Add Rails 3 railtie for automatically loading rake tasks when installed as a gem
50
+
51
+ == 0.8.1 / 2010-03-14
52
+
53
+ * Release gems via rake-gemcutter instead of rubyforge
54
+ * Move rake tasks to lib/tasks
55
+ * Dispatch state behavior to the superclass if it's undefined for a particular state [Sandro Turriate and Tim Pope]
56
+ * Fix state / event names not supporting i18n in ActiveRecord
57
+ * Fix original ActiveRecord::Observer#update not being used for non-state_machine callbacks [Jeremy Wells]
58
+ * Add support for ActiveRecord 3.0
59
+ * Fix without_{name} scopes not quoting columns in ActiveRecord [Jon Evans]
60
+ * Fix without_{name} scopes not scoping columns to the table in ActiveRecord and Sequel [Jon Evans]
61
+ * Fix custom state attributes not being marked properly as changed in ActiveRecord
62
+ * Fix tracked attributes changes in ActiveRecord / DataMapper integrations not working correctly for non-loopbacks [Joe Lind]
63
+ * Fix plural scope names being incorrect for DataMapper 0.9.4 - 0.9.6
64
+ * Fix deprecation warnings for ruby-graphviz 0.9.0+
65
+ * Add support for ActiveRecord 2.0.*
66
+ * Fix nil states being overwritten when they're explicitly set in ORM integrations
67
+ * Fix default states not getting set in ORM integrations if the column has a default
68
+ * Fix event transitions being kept around while running actions/callbacks, sometimes preventing object marshalling
69
+
70
+ == 0.8.0 / 2009-08-15
71
+
72
+ * Add support for DataMapper 0.10.0
73
+ * Always interpet nil return values from actions as failed attempts
74
+ * Fix loopbacks not causing records to save in ORM integrations if no other fields were changed
75
+ * Fix events not failing with useful errors when an object's state is invalid
76
+ * Use more friendly NoMethodError messages for state-driven behaviors
77
+ * Fix before_transition callbacks getting run twice when using event attributes in ORM integrations
78
+ * Add the ability to query for the availability of specific transitions on an object
79
+ * Allow after_transition callbacks to be explicitly run on failed attempts
80
+ * By default, don't run after_transition callbacks on failed attempts
81
+ * Fix not allowing multiple methods to be specified as arguments in callbacks
82
+ * Fix initial states being set when loading records from the database in Sequel integration
83
+ * Allow static initial states to be set earlier in the initialization of an object
84
+ * Use friendly validation errors for nil states
85
+ * Fix states not being validated properly when using custom names in ActiveRecord / DataMapper integrations
86
+
87
+ == 0.7.6 / 2009-06-17
88
+
89
+ * Allow multiple state machines on the same class to target the same attribute
90
+ * Add support for :attribute to customize the attribute target, assuming the name is the first argument of #state_machine
91
+ * Simplify reading from / writing to machine-related attributes on objects
92
+ * Fix locale for ActiveRecord getting added to the i18n load path multiple times [Reiner Dieterich]
93
+ * Fix callbacks, guards, and state-driven behaviors not always working on tainted classes [Brandon Dimcheff]
94
+ * Use Ruby 1.9's built-in Object#instance_exec for bound callbacks when it's available
95
+ * Improve performance of cached dynamic state lookups by 25%
96
+
97
+ == 0.7.5 / 2009-05-25
98
+
99
+ * Add built-in caching for dynamic state values when the value only needs to be generated once
100
+ * Fix flawed example for using record ids as state values
101
+ * Don't evaluate state values until they're actually used in an object instance
102
+ * Make it easier to use event attributes for actions defined in the same class as the state machine
103
+ * Fix #save/save! running transitions in ActiveRecord integrations even when a machine's action is not :save
104
+
105
+ == 0.7.4 / 2009-05-23
106
+
107
+ * Fix #save! not firing event attributes properly in ActiveRecord integrations
108
+ * Fix log files being included in gems
109
+
110
+ == 0.7.3 / 2009-04-25
111
+
112
+ * Require DataMapper version be >= 0.9.4
113
+ * Explicitly load Sequel's built-in inflector (>= 2.12.0) for scope names
114
+ * Don't use qualified name for event attributes
115
+ * Fix #valid? being defined for DataMapper resources when dm-validations isn't loaded
116
+ * Add auto-validation of values allowed for the state attribute in ORM integrations
117
+
118
+ == 0.7.2 / 2009-04-08
119
+
120
+ * Add support for running multiple methods in a callback without using blocks
121
+ * Add more flexibility around how callbacks are defined
122
+ * Add security documentation around mass-assignment in ORM integrations
123
+ * Fix event attribute transitions being publicly accessible
124
+
125
+ == 0.7.1 / 2009-04-05
126
+
127
+ * Fix machines failing to generate graphs when run from Merb tasks
128
+
129
+ == 0.7.0 / 2009-04-04
130
+
131
+ * Add #{attribute}_event for automatically firing events when the object's action is called
132
+ * Make it easier to override state-driven behaviors
133
+ * Rollback state changes when the action fails during transitions
134
+ * Use :messages instead of :invalid_message for customizing validation errors
135
+ * Use more human-readable validation errors
136
+ * Add support for more ActiveRecord observer hooks
137
+ * Add support for targeting multiple specific state machines in DataMapper observer hooks
138
+ * Don't pass the result of the action as an argument to callbacks (access via Transition#result)
139
+ * Fix incorrect results being used when running transitions in parallel
140
+ * Fix transition args not being set when run in parallel
141
+ * Allow callback terminators to be set on an application-wide basis
142
+ * Only catch :halt during before / after transition callbacks
143
+ * Fix ActiveRecord predicates being overwritten if they're already defined in the class
144
+ * Allow machine options to be set on an integration-wide basis
145
+ * Turn transactions off by default in DataMapper integrations
146
+ * Add support for configuring the use of transactions
147
+ * Simplify reading/writing of attributes
148
+ * Simplify access to state machines via #state_machine(:attribute) without generating dupes
149
+ * Fix assumptions that dm-validations is always available in DataMapper integration
150
+ * Automatically define DataMapper properties for machine attributes if they don't exist
151
+ * Add Transition#qualified_event, #qualified_from_name, and #qualified_to_name
152
+ * Add #fire_events / #fire_events! for running events on multiple state machines in parallel
153
+ * Rename next_#{event}_transition to #{event}_transition
154
+ * Add #{attribute}_transitions for getting the list of transitions that can be run on an object
155
+ * Add #{attribute}_events for getting the list of events that can be fired on an object
156
+ * Use generated non-bang event when running bang version so that overriding one affects the other
157
+ * Provide access to arguments passed into an event from transition callbacks via Transition#args
158
+
159
+ == 0.6.3 / 2009-03-10
160
+
161
+ * Add support for customizing the graph's orientation
162
+ * Use the standard visualizations for initial (open arrow) and final (double circle) states
163
+ * Highlight final states in GraphViz drawings
164
+
165
+ == 0.6.2 / 2009-03-08
166
+
167
+ * Make it easier to override generated instance / class methods
168
+
169
+ == 0.6.1 / 2009-03-07
170
+
171
+ * Add i18n support for ActiveRecord validation errors
172
+ * Add a validation error when failing to transition for ActiveRecord / DataMapper / Sequel integrations
173
+
174
+ == 0.6.0 / 2009-03-03
175
+
176
+ * Allow multiple conditions for callbacks / class behaviors
177
+ * Add support for state-driven class behavior with :if/:unless options
178
+ * Alias Machine#event as Machine#on
179
+ * Fix nil from/to states not being handled properly
180
+ * Simplify hooking callbacks into loopbacks
181
+ * Add simplified transition/callback requirement syntax
182
+
183
+ == 0.5.2 / 2009-02-17
184
+
185
+ * Improve pretty-print of events
186
+ * Simplify state/event matching design, improving guard performance by 30%
187
+ * Add better error notification when conflicting guard options are defined
188
+ * Fix scope name pluralization not being applied correctly
189
+
190
+ == 0.5.1 / 2009-02-11
191
+
192
+ * Allow states to be drawn as ellipses to accommodate long names
193
+ * Fix rake tasks not being registered in Rails/Merb applications
194
+ * Never automatically define machine attribute accessors when using an integration
195
+
196
+ == 0.5.0 / 2009-01-11
197
+
198
+ * Add to_name and from_name to transition objects
199
+ * Add nicely formatted #inspect for transitions
200
+ * Fix ActiveRecord integrations failing when the database doesn't exist yet
201
+ * Fix states not being drawn in GraphViz graphs in the correct order
202
+ * Add nicely formatted #inspect for states and events
203
+ * Simplify machine context-switching
204
+ * Store events/states in enumerable node collections
205
+ * No longer allow subclasses to change the integration
206
+ * Move fire! action logic into the Event class (no longer calls fire action on the object)
207
+ * Allow states in subclasses to have different values
208
+ * Recommend that all states be referenced as symbols instead of strings
209
+ * All states must now be named (and can be associated with other value types)
210
+ * Add support for customizing the actual stored value for a state
211
+ * Add compatibility with Ruby 1.9+
212
+
213
+ == 0.4.3 / 2008-12-28
214
+
215
+ * Allow dm-observer integration to be optional
216
+ * Fix non-lambda callbacks not working for DataMapper/Sequel
217
+
218
+ == 0.4.2 / 2008-12-28
219
+
220
+ * Fix graphs not being drawn the same way consistently
221
+ * Add support for sharing transitions across multiple events
222
+ * Add support for state-driven behavior
223
+ * Simplify initialize hooks, requiring super to be called instead
224
+ * Add :namespace option for generated state predicates / event methods
225
+
226
+ == 0.4.1 / 2008-12-16
227
+
228
+ * Fix nil states not being handled properly in guards, known states, or visualizations
229
+ * Fix the same node being used for different dynamic states in GraphViz output
230
+ * Always include initial state in the list of known states even if it's dynamic
231
+ * Use consistent naming scheme for dynamic states in GraphViz output
232
+ * Allow blocks to be directly passed into machine class
233
+ * Fix attribute predicates not working on attributes that represent columns in ActiveRecord
234
+
235
+ == 0.4.0 / 2008-12-14
236
+
237
+ * Remove the PluginAWeek namespace
238
+ * Add generic attribute predicate (e.g. "#{attribute}?(state_name)") and state predicates (e.g. "#{state}?")
239
+ * Add Sequel support
240
+ * Fix aliasing :initialize on ActiveRecord models causing warnings when the environment is reloaded
241
+ * Fix ActiveRecord state machines trying to query the database on unmigrated models
242
+ * Fix initial states not getting set when the current value is an empty string [Aaron Gibralter]
243
+ * Add rake tasks for generating graphviz files for state machines [Nate Murray]
244
+ * Fix initial state not being included in list of known states
245
+ * Add other_states directive for defining additional states not referenced in transitions or callbacks [Pete Forde]
246
+ * Add next_#{event}_transition for getting the next transition that would be performed if the event were invoked
247
+ * Add the ability to override the pluralized name of an attribute for creating scopes
248
+ * Add the ability to halt callback chains by: throw :halt
249
+ * Add support for dynamic to states in transitions (e.g. :to => lambda {Time.now})
250
+ * Add support for using real blocks in before_transition/after_transition calls instead of using the :do option
251
+ * Add DataMapper support
252
+ * Include states referenced in transition callbacks in the list of a machine's known states
253
+ * Only generate the known states for a machine on demand, rather than calculating beforehand
254
+ * Add the ability to skip state change actions during a transition (e.g. vehicle.ignite(false))
255
+ * Add the ability for the state change action (e.g. +save+ for ActiveRecord) to be configurable
256
+ * Allow state machines to be defined on *any* Ruby class, not just ActiveRecord (removes all external dependencies)
257
+ * Refactor transitions, guards, and callbacks for better organization/design
258
+ * Use a class containing the transition context in callbacks, rather than an ordered list of each individual attribute
259
+ * Add without_#{attribute} named scopes (opposite of the existing with_#{attribute} named scopes) [Sean O'Brien]
260
+
261
+ == 0.3.1 / 2008-10-26
262
+
263
+ * Fix the initial state not getting set when the state attribute is mass-assigned but protected
264
+ * Change how the base module is included to prevent namespacing conflicts
265
+
266
+ == 0.3.0 / 2008-09-07
267
+
268
+ * No longer allow additional arguments to be passed into event actions
269
+ * Add support for can_#{event}? for checking whether an event can be fired based on the current state of the record
270
+ * Don't use callbacks for performing transitions
271
+ * Fix state machines in subclasses not knowing what states/events/transitions were defined by superclasses
272
+ * Replace all before/after_exit/enter/loopback callback hooks and :before/:after options for events with before_transition/after_transition callbacks, e.g.
273
+
274
+ before_transition :from => 'parked', :do => :lock_doors # was before_exit :parked, :lock_doors
275
+ after_transition :on => 'ignite', :do => :turn_on_radio # was event :ignite, :after => :turn_on_radio do
276
+
277
+ * Always save when an event is fired even if it results in a loopback [Jürgen Strobel]
278
+ * Ensure initial state callbacks are invoked in the proper order when an event is fired on a new record
279
+ * Add before_loopback and after_loopback hooks [Jürgen Strobel]
280
+
281
+ == 0.2.1 / 2008-07-05
282
+
283
+ * Add more descriptive exceptions
284
+ * Assume the default state attribute is "state" if one is not provided
285
+ * Add :except_from option for transitions if you want to blacklist states
286
+ * Add PluginAWeek::StateMachine::Machine#states
287
+ * Add PluginAWeek::StateMachine::Event#transitions
288
+ * Allow creating transitions with no from state (effectively allowing the transition for *any* from state)
289
+ * Reduce the number of objects created for each transition
290
+
291
+ == 0.2.0 / 2008-06-29
292
+
293
+ * Add a non-bang version of events (e.g. park) that will return a boolean value for success
294
+ * Raise an exception if the bang version of events are used (e.g. park!) and no transition is successful
295
+ * Change callbacks to act a little more like ActiveRecord
296
+ * Avoid using string evaluation for dynamic methods
297
+
298
+ == 0.1.1 / 2008-06-22
299
+
300
+ * Remove log files from gems
301
+
302
+ == 0.1.0 / 2008-05-05
303
+
304
+ * Completely rewritten from scratch
305
+ * Renamed to state_machine
306
+ * Removed database dependencies
307
+ * Removed models in favor of an attribute-agnostic design
308
+ * Use ActiveSupport::Callbacks instead of eval_call
309
+ * Remove dry_transaction_rollbacks dependencies
310
+ * Added functional tests
311
+ * Updated documentation
312
+
313
+ == 0.0.1 / 2007-09-26
314
+
315
+ * Add dependency on custom_callbacks
316
+ * Move test fixtures out of the test application root directory
317
+ * Improve documentation
318
+ * Remove the StateExtension module in favor of adding singleton methods to the stateful class
319
+ * Convert dos newlines to unix newlines
320
+ * Fix error message when a given event can't be found in the database
321
+ * Add before_#{action} and #{action} callbacks when an event is performed
322
+ * All state and event callbacks can now explicitly return false in order to cancel the action
323
+ * Refactor ActiveState callback creation
324
+ * Refactor unit tests so that they use mock classes instead of themselves
325
+ * Allow force_reload option to be set in the state association
326
+ * Don't save the entire model when updating the state_id
327
+ * Raise exception if a class tries to define a state more than once
328
+ * Add tests for PluginAWeek::Has::States::ActiveState
329
+ * Refactor active state/active event creation
330
+ * Fix owner_type not being set correctly in active states/events of subclasses
331
+ * Allow subclasses to override the initial state
332
+ * Fix problem with migrations using default null when column cannot be null
333
+ * Moved deadline support into a separate plugin (has_state_deadlines).
334
+ * Added many more unit tests.
335
+ * Simplified many of the interfaces for maintainability.
336
+ * Added support for turning off recording state changes.
337
+ * Removed the short_description and long_description columns, in favor of an optional human_name column.
338
+ * Fixed not overriding the correct equality methods in the StateTransition class.
339
+ * Added to_sym to State and Event.
340
+ * State#name and Event#name now return the string version of the name instead of the symbol version.
341
+ * Added State#human_name and Event#human_name to automatically figure out what the human name is if it isn't specified in the table.
342
+ * Updated manual rollbacks to use the new Rails edge api (ActiveRecord::Rollback exception).
343
+ * Moved StateExtension class into a separate file in order to help keep the has_state files clean.
344
+ * Renamed InvalidState and InvalidEvent exceptions to StateNotFound and EventNotFound in order to follow the ActiveRecord convention (i.e. RecordNotFound).
345
+ * Added StateNotActive and EventNotActive exceptions to help differentiate between states which don't exist and states which weren't defined in the class.
346
+ * Added support for defining callbacks like so:
347
+
348
+ def before_exit_parked
349
+ end
350
+
351
+ def after_enter_idling
352
+ end
353
+
354
+ * Added support for defining callbacks using class methods:
355
+
356
+ before_exit_parked :fasten_seatbelt
357
+
358
+ * Added event callbacks after the transition has occurred (e.g. after_park)
359
+ * State callbacks no longer receive any of the arguments that were provided in the event action
360
+ * Updated license to include our names.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2006-2010 Aaron Pfefier
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.