state_machine 0.7.0 → 0.7.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.
- data/CHANGELOG.rdoc +5 -1
- data/README.rdoc +6 -6
- data/Rakefile +1 -1
- data/tasks/state_machine.rb +5 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
== master
|
2
2
|
|
3
|
-
== 0.7.
|
3
|
+
== 0.7.1 / 2009-04-05
|
4
|
+
|
5
|
+
* Fix machines failing to generate graphs when run from Merb tasks
|
6
|
+
|
7
|
+
== 0.7.0 / 2009-04-04
|
4
8
|
|
5
9
|
* Add #{attribute}_event for automatically firing events when the object's action is called
|
6
10
|
* Make it easier to override state-driven behaviors
|
data/README.rdoc
CHANGED
@@ -163,6 +163,10 @@ Class definition:
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
*Note* the comment made on the +initialize+ method in the class. In order for
|
167
|
+
state machine attributes to be properly initialized, <tt>super()</tt> must be called.
|
168
|
+
See StateMachine::MacroMethods for more information about this.
|
169
|
+
|
166
170
|
Using the above class as an example, you can interact with the state machine
|
167
171
|
like so:
|
168
172
|
|
@@ -217,10 +221,6 @@ like so:
|
|
217
221
|
|
218
222
|
vehicle.fire_events!(:ignite, :enable_alarm) # => StateMachine::InvalidTransition: Cannot run events in parallel: ignite, enable_alarm
|
219
223
|
|
220
|
-
*Note* the comment made on the +initialize+ method in the class. In order for
|
221
|
-
state machine attributes to be properly initialized, <tt>super()</tt> must be called.
|
222
|
-
See StateMachine::MacroMethods for more information about this.
|
223
|
-
|
224
224
|
== Integrations
|
225
225
|
|
226
226
|
In addition to being able to define state machines on all Ruby classes, a set of
|
@@ -267,7 +267,7 @@ saving the record, named scopes, validation errors, and observers. For example,
|
|
267
267
|
# log message
|
268
268
|
end
|
269
269
|
|
270
|
-
# Generic transition callback *
|
270
|
+
# Generic transition callback *after* the transition is performed
|
271
271
|
def after_transition(vehicle, transition)
|
272
272
|
Audit.log(vehicle, transition)
|
273
273
|
end
|
@@ -318,7 +318,7 @@ callbacks, validation errors, and observers. For example,
|
|
318
318
|
# log message (self is the record)
|
319
319
|
end
|
320
320
|
|
321
|
-
# Generic transition callback *
|
321
|
+
# Generic transition callback *after* the transition is performed
|
322
322
|
after_transition do |transition|
|
323
323
|
Audit.log(self, transition) # self is the record
|
324
324
|
end
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/contrib/sshpublisher'
|
|
5
5
|
|
6
6
|
spec = Gem::Specification.new do |s|
|
7
7
|
s.name = 'state_machine'
|
8
|
-
s.version = '0.7.
|
8
|
+
s.version = '0.7.1'
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.summary = 'Adds support for creating state machines for attributes on any Ruby class'
|
11
11
|
|
data/tasks/state_machine.rb
CHANGED
@@ -21,6 +21,10 @@ namespace :state_machine do
|
|
21
21
|
task :rails => [:environment, 'state_machine:draw']
|
22
22
|
|
23
23
|
desc 'Draws a set of state machines using GraphViz for a Merb application. Target class with CLASS=x,y,z; Font name with FONT=x; Image format with FORMAT=x; Orientation with ORIENTATION=x'
|
24
|
-
task :merb => [:merb_env
|
24
|
+
task :merb => [:merb_env] do
|
25
|
+
# Fix ruby-graphviz being incompatible with Merb's process title
|
26
|
+
$0 = 'rake'
|
27
|
+
Rake::Task['state_machine:draw'].invoke
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-05 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|