<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 == master
 
+* Add PluginAWeek::StateMachine::Machine#states
+* Add PluginAWeek::StateMachine::Event#transitions
 * Allow creating transitions with no from state (effectively allowing the transition for *any* from state)
 * Reduce the number of objects created for each transition
 </diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,9 @@ module PluginAWeek #:nodoc:
       # The name of the action that fires the event
       attr_reader :name
       
+      # The list of transitions that can be made for this event
+      attr_reader :transitions
+      
       delegate  :owner_class,
                   :to =&gt; :machine
       
@@ -21,6 +24,7 @@ module PluginAWeek #:nodoc:
         @machine = machine
         @name = name
         @options = options.stringify_keys
+        @transitions = []
         
         add_transition_actions
         add_transition_callbacks
@@ -63,6 +67,7 @@ module PluginAWeek #:nodoc:
         callback = Proc.new {|record, *args| try_transition(transition, true, record, *args)}
         owner_class.send(&quot;transition_bang_on_#{name}&quot;, callback, options)
         
+        transitions &lt;&lt; transition
         transition
       end
       </diff>
      <filename>lib/state_machine/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,9 @@ module PluginAWeek #:nodoc:
       # The events that trigger transitions
       attr_reader :events
       
+      # A list of the states defined in the transitions of all of the events
+      attr_reader :states
+      
       # The attribute for which the state machine is being defined
       attr_accessor :attribute
       
@@ -44,6 +47,7 @@ module PluginAWeek #:nodoc:
         @attribute = attribute.to_s
         @initial_state = options[:initial]
         @events = {}
+        @states = []
         
         add_named_scopes
       end
@@ -110,6 +114,12 @@ module PluginAWeek #:nodoc:
         name = name.to_s
         event = events[name] = Event.new(self, name, options)
         event.instance_eval(&amp;block)
+        
+        # Record the states
+        event.transitions.each do |transition|
+          @states |= ([transition.to_state] + transition.from_states)
+        end
+        
         event
       end
       </diff>
      <filename>lib/state_machine/machine.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,10 @@ class EventTest &lt; Test::Unit::TestCase
     assert_equal 'turn_on', @event.name
   end
   
+  def test_should_not_have_any_transitions
+    assert @event.transitions.empty?
+  end
+  
   def test_should_define_an_event_action_on_the_owner_class
     switch = new_switch
     assert switch.respond_to?(:turn_on)
@@ -81,6 +85,11 @@ class EventWithTransitionsTest &lt; Test::Unit::TestCase
     assert @event.transition(:to =&gt; 'on', :from =&gt; %w(off on))
   end
   
+  def test_should_have_transitions
+    @event.transition(:to =&gt; 'on')
+    assert @event.transitions.any?
+  end
+  
   def teardown
     Switch.class_eval do
       @transition_on_turn_on_callbacks = nil</diff>
      <filename>test/unit/event_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,6 +20,10 @@ class MachineByDefaultTest &lt; Test::Unit::TestCase
   def test_should_not_have_any_events
     assert @machine.events.empty?
   end
+  
+  def test_should_not_have_any_states
+    assert @machine.states.empty?
+  end
 end
 
 class MachineWithInvalidOptionsTest &lt; Test::Unit::TestCase
@@ -121,9 +125,27 @@ class MachineWithEventsTest &lt; Test::Unit::TestCase
     assert responded
   end
   
-  def test_should_store_the_event
+  def test_should_have_events
     @machine.event(:turn_on) {}
-    assert_equal 1, @machine.events.size
+    assert_equal %w(turn_on), @machine.events.keys
+  end
+end
+
+class MachineWithEventsAndTransitionsTest &lt; Test::Unit::TestCase
+  def setup
+    @machine = PluginAWeek::StateMachine::Machine.new(Switch, 'state')
+    @machine.event(:turn_on) do
+      transition :to =&gt; 'on', :from =&gt; 'off'
+      transition :to =&gt; 'error', :from =&gt; 'unknown'
+    end
+  end
+  
+  def test_should_have_events
+    assert_equal %w(turn_on), @machine.events.keys
+  end
+  
+  def test_should_have_states
+    assert_equal %w(on off error unknown), @machine.states
   end
 end
 </diff>
      <filename>test/unit/machine_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b90d731c157acfc564e61fedecb4819732536ec2</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </author>
  <url>http://github.com/pluginaweek/state_machine/commit/26d60afa4705981762799dfc36d46794b2bff370</url>
  <id>26d60afa4705981762799dfc36d46794b2bff370</id>
  <committed-date>2008-07-03T15:10:02-07:00</committed-date>
  <authored-date>2008-07-03T15:10:02-07:00</authored-date>
  <message>Add PluginAWeek::StateMachine::Machine#states
Add PluginAWeek::StateMachine::Event#transitions</message>
  <tree>82158d75a977b57f20ee1bf8dcf529cefba2bfbf</tree>
  <committer>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </committer>
</commit>
