dm-is-state_machine 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc
CHANGED
@@ -38,6 +38,13 @@ module DataMapper
|
|
38
38
|
machine = Data::Machine.new(column, initial)
|
39
39
|
@is_state_machine = { :machine => machine }
|
40
40
|
|
41
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
42
|
+
def #{column}=(value)
|
43
|
+
value = value.to_s if value.kind_of?(Symbol)
|
44
|
+
attribute_set(#{column.inspect}, value)
|
45
|
+
end
|
46
|
+
RUBY
|
47
|
+
|
41
48
|
# ===== Define callbacks =====
|
42
49
|
# TODO: define callbacks
|
43
50
|
# before :save do
|
@@ -106,9 +113,9 @@ module DataMapper
|
|
106
113
|
def transition!(event_name)
|
107
114
|
machine = model.instance_variable_get(:@is_state_machine)[:machine]
|
108
115
|
column = machine.column
|
109
|
-
machine.current_state_name =
|
116
|
+
machine.current_state_name = send(column)
|
110
117
|
machine.fire_event(event_name, self)
|
111
|
-
|
118
|
+
send("#{column}=", machine.current_state_name)
|
112
119
|
end
|
113
120
|
|
114
121
|
end # InstanceMethods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David James
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dm-core
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.10.1
|
24
|
+
version:
|
16
25
|
description: DataMapper plugin for creating state machines
|
17
26
|
email:
|
18
27
|
- djwonk [a] collectiveinsight [d] net
|