Slide 59
Slide 59 text
State Machine Example
Example from remailer library:
state :auth do
enter do
send_line("AUTH PLAIN #{encode_authentication(username, password)}")
end
interpret(235) do
enter_state(:established)
end
interpret(535) do |reply_message, continues|
handle_reply_continuation(535, reply_message, continues) do |reply_code, reply_message|
error_notification(reply_code, reply_message)
enter_state(:quit)
end
end
end
59
Monday, July 30, 12