README.md in finite-1.0.0 vs README.md in finite-1.1.0
- old
+ new
@@ -17,18 +17,23 @@
$ gem install finite
## Usage
```ruby
+require 'finite'
class Elevator
include Finite
+ def initialize
+ @broken = false
+ end
+
finite initial: :idle do
before do
- "This is called before every state but has no purpose other than to show it's existence in this example."
+ "This is called before every state but has no purpose other than to show its existence in this example."
end
before :doors_closing do
puts 'Doors Closing!'
end
@@ -36,11 +41,11 @@
before :doors_opening do
puts 'Doors Opening!'
end
event :prepare do
- go from: :idle, to: :doors_closing
+ go from: :idle, to: :doors_closing, if: -> { not @broken }
end
event :go_up do
go from: :doors_closing, to: :elevator_going_up
after do
@@ -96,11 +101,11 @@
```ruby
elevator = Elevator.new
elevator.current_state # => :idle
elevator.can_prepare? # => true
elevator.can_open_doors? # => false
-elevator.open_doors # => RuntimeError 'Invalid Transition'
+elevator.open_doors # => Finite::Error 'Invalid Transition'
elevator.idle? # => true
elevator.prepare # => 'Doors Closing!'
elevator.current_state # => :doors_closing
elevator.possible_events # => [:go_up, :go_down]
```
@@ -112,11 +117,11 @@
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## License
-Copyright (c) 2013 Kristen Mills
+Copyright (c) 2014 Kristen Mills
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -133,6 +138,6 @@
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.