public
Rubygem
Description: AASM - State machines for Ruby classes
Homepage: http://rubyi.st/aasm
Clone URL: git://github.com/rubyist/aasm.git
Search Repo:
Click here to lend your support to: aasm and make a donation at www.pledgie.com !
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-Copyright (c) 2006 Scott Barron
0
+Copyright (c) 2008 Scott Barron
0
 
0
 Permission is hereby granted, free of charge, to any person obtaining
0
 a copy of this software and associated documentation files (the
...
14
15
16
17
18
19
20
...
14
15
16
 
17
18
19
0
@@ -14,7 +14,6 @@ rescue Exception
0
   nil
0
 end
0
 
0
-# Version
0
 if `ruby -Ilib -rversion -e "print AASM::VERSION::STRING"` =~ /([0-9.]+)$/
0
   CURRENT_VERSION = $1
0
 else
0
...
4
5
6
7
8
9
10
...
4
5
6
 
7
8
9
0
@@ -4,7 +4,6 @@ Before Next Release:
0
 * Add automatic persistence hooks for ActiveRecord classes
0
 * Add #aasm_next_state_for_event
0
 * Add #aasm_next_states_for_event
0
-* Add .states
0
 
0
 
0
 Cool ideas from users:
...
20
21
22
 
23
24
25
...
28
29
30
31
 
 
 
32
33
34
...
41
42
43
 
 
 
 
44
45
46
...
20
21
22
23
24
25
26
...
29
30
31
 
32
33
34
35
36
37
...
44
45
46
47
48
49
50
51
52
53
0
@@ -20,6 +20,7 @@ module AASM
0
     alias :initial_state :aasm_initial_state=
0
     
0
     def state(name, options={})
0
+ aasm_states << name unless aasm_states.include?(name)
0
       self.aasm_initial_state = name unless self.aasm_initial_state
0
 
0
       define_method("#{name.to_s}?") do
0
@@ -28,7 +29,9 @@ module AASM
0
     end
0
     
0
     def event(name, &block)
0
- aasm_events[name] = AASM::SupportingClasses::Event.new(name, &block)
0
+ unless aasm_events.has_key?(name)
0
+ aasm_events[name] = AASM::SupportingClasses::Event.new(name, &block)
0
+ end
0
 
0
       define_method("#{name.to_s}!") do
0
         new_state = self.class.aasm_events[name].fire(self)
0
@@ -41,6 +44,10 @@ module AASM
0
       end
0
     end
0
 
0
+ def aasm_states
0
+ @aasm_states ||= []
0
+ end
0
+
0
     def aasm_events
0
       @aasm_events ||= {}
0
     end

Comments

    No one has commented yet.