Class: Uppercut::Conversation

Inherits:
Message
  • Object
show all
Defined in:
lib/uppercut/conversation.rb

Instance Attribute Summary collapse

Attributes inherited from Message

#message

Instance Method Summary collapse

Methods inherited from Message

#send

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

#toObject (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.bare,&block)
end