baby_bots 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,10 +61,15 @@ module BabyBots
61
61
 
62
62
  # check if we need to preprocess the event
63
63
  if respond_to?("pre_#{@curr.state}")
64
- event = send("pre_#{@curr.state}", event)
64
+ cooked_event = send("pre_#{@curr.state}", event)
65
+ end
66
+
67
+ if cooked_event
68
+ next_state = @states[curr.table[cooked_event]]
69
+ else
70
+ next_state = @states[curr.table[event]]
65
71
  end
66
72
 
67
- next_state = @states[curr.table[event]]
68
73
  if next_state.nil?
69
74
  next_state = @states[curr.table[:else]]
70
75
  end
@@ -80,6 +85,8 @@ module BabyBots
80
85
  # as the "return" from any state transition (even self-looping transitions)
81
86
  if respond_to?("post_#{@curr.state}")
82
87
  ret_val = send("post_#{@curr.state}", event)
88
+ elsif respond_to?("post_cooked_#{curr.state}")
89
+ ret_val = send("post_#{@curr.state}", cooked_event)
83
90
  end
84
91
 
85
92
 
@@ -1,3 +1,3 @@
1
1
  module BabyBots
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baby_bots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-30 00:00:00.000000000Z
12
+ date: 2012-05-01 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A tiny finite-state automata library.
15
15
  email: justinanthonyhamilton@gmail.com