Class: Uppercut::Conversation
- Defined in:
- lib/uppercut/conversation.rb
Instance Attribute Summary collapse
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(to, base) ⇒ Conversation
constructor
:nodoc:.
-
#wait_for(&block) ⇒ Object
Wait for another message from this contact.
Methods inherited from Message
Constructor Details
#initialize(to, base) ⇒ Conversation
:nodoc:
5 6 7 8 |
# File 'lib/uppercut/conversation.rb', line 5 def initialize(to,base) #:nodoc: @to = to super base end |
Instance Attribute Details
#to ⇒ Object (readonly)
Returns the value of attribute to.
3 4 5 |
# File 'lib/uppercut/conversation.rb', line 3 def to @to end |
Instance Method Details
#wait_for(&block) ⇒ Object
Wait for another message from this contact.
Expects a block which should receive one parameter, which will be a String.
One common use of wait_for is for confirmation of a sensitive action.
command('foo') do |c|
c.send 'Are you sure?'
c.wait_for do |reply|
do_it if reply.downcase == 'yes'
end
end
23 24 25 |
# File 'lib/uppercut/conversation.rb', line 23 def wait_for(&block) @base.redirect_from(@to.,&block) end |