README.md in end_state-0.12.0 vs README.md in end_state-1.0.0
- old
+ new
@@ -1,5 +1,9 @@
+[![Build Status](https://travis-ci.org/Originate/end_state.svg?branch=master)](https://travis-ci.org/Originate/end_state)
+[![Code Climate](https://codeclimate.com/github/Originate/end_state/badges/gpa.svg)](https://codeclimate.com/github/Originate/end_state)
+[![Coverage Status](https://coveralls.io/repos/Originate/end_state/badge.png)](https://coveralls.io/r/Originate/end_state)
+
# EndState
EndState is an unobtrusive way to add state machines to your application.
An `EndState::StateMachine` acts as a decorator of sorts for your stateful object.
@@ -30,12 +34,12 @@
```ruby
class Machine < EndState::StateMachine
transition parked: :idling, as: :start
transition idling: :first_gear, first_gear: :second_gear, second_gear: :third_gear, as: :shift_up
- transition third_gear: :second_gear, second_gear: :first_gear, as: shift_down
- transition first_gear: :idling, as: idle
+ transition third_gear: :second_gear, second_gear: :first_gear, as: :shift_down
+ transition first_gear: :idling, as: :idle
transition [:idling, :first_gear] => :parked, as: :park
end
```
Use it by wrapping a stateful object.
@@ -237,28 +241,22 @@
```
## Events
By using the `as` option in a transition definition you are creating an event representing that transition.
-This can allow you to exercise the machine in a more natural "verb" style interaction. When using `as` event
-definitions you can optionally set a `blocked` message on the transition. When the event is executed, if the
-machine is not in the initial state of the event, the message is added to the `failure_messages`
-array on the machine. Events, like `transition` have both a standard and a bang (`!`) style. The bang style
-will raise an exception if there is a problem.
+This can allow you to exercise the machine in a more natural "verb" style interaction. Events, like `transition`
+have both a standard and a bang (`!`) style. The bang style will raise an exception if there is a problem.
```ruby
class Machine < EndState::StateMachine
- transition a: :b, as: :go do |t|
- t.blocked 'Cannot go!'
- end
+ transition a: :b, as: :go
end
machine = Machine.new(StatefulObject.new(:a))
machine.go # => true
machine.state # => :b
machine.go # => false
-machine.failure_messages # => ['Cannot go!']
machine.go! # => raises InvalidTransition
```
## Parameters