Skip to content

Commit

Permalink
+ rubykaigi presentation additions
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Jul 17, 2011
1 parent 1701bd0 commit f3e0218
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/dave_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

James.dialog do

hear 'James, I am going to close you now.' => :dave
hear 'Open the door.' => :sorry

state :dave do
state :sorry do
into do
"I'm sorry Dave, I can't let you do that."
"I'm sorry Dave. I'm afraid I can't do that."
end
end

Expand Down
3 changes: 2 additions & 1 deletion examples/magic_eight_ball_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def initialize
end

hear 'Shake the eight ball' => :shake,
'I have a question' => :shake
'I have a question' => :shake,
'What do you think?' => :shake

state :shake do
hear ['Shake the eight ball', 'I have another question', 'Again']
Expand Down
2 changes: 1 addition & 1 deletion lib/james/dialog_internals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def hear definition
# end
#
def state name, &block
@states ||= {}
@states ||= {} # Move to initializer.
@states[name] ||= block if block_given?
define_method name do
state_for name
Expand Down

0 comments on commit f3e0218

Please sign in to comment.