asoules-aasm 2.0.5.2 → 2.0.5.3
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/lib/aasm.rb +3 -0
- data/lib/event.rb +2 -0
- data/lib/version.rb +1 -1
- metadata +1 -1
data/lib/aasm.rb
CHANGED
@@ -14,6 +14,9 @@ module AASM
|
|
14
14
|
class UndefinedState < RuntimeError
|
15
15
|
end
|
16
16
|
|
17
|
+
class TransitionGuarded < RuntimeError
|
18
|
+
end
|
19
|
+
|
17
20
|
def self.included(base) #:nodoc:
|
18
21
|
# TODO - need to ensure that a machine is being created because
|
19
22
|
# AASM was either included or arrived at via inheritance. It
|
data/lib/event.rb
CHANGED
@@ -23,6 +23,8 @@ module AASM
|
|
23
23
|
next_state = to_state || Array(transition.to).first
|
24
24
|
transition.execute(obj, *args)
|
25
25
|
break
|
26
|
+
else
|
27
|
+
raise AASM::TransitionGuarded, "Event '#{name}' was guarded against transition from '#{obj.aasm_current_state}'"
|
26
28
|
end
|
27
29
|
end
|
28
30
|
next_state
|
data/lib/version.rb
CHANGED