Class: Rype::Chat

Inherits:
Object
  • Object
show all
Defined in:
lib/rype/chat.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chatname) ⇒ Chat

Returns a new instance of Chat.



20
21
22
# File 'lib/rype/chat.rb', line 20

def initialize(chatname)
  @chatname = chatname
end

Class Attribute Details

.chatsObject

Returns the value of attribute chats.



6
7
8
# File 'lib/rype/chat.rb', line 6

def chats
  @chats
end

Instance Attribute Details

#chatnameObject (readonly)

Returns the value of attribute chatname.



18
19
20
# File 'lib/rype/chat.rb', line 18

def chatname
  @chatname
end

Class Method Details

.all {|chats| ... } ⇒ Object

Yields:



8
9
10
11
12
13
14
15
# File 'lib/rype/chat.rb', line 8

def all
  chats if chats

  Api.invoke("SEARCH CHATS")
  sleep 0.01 while chats.nil?
  
  yield chats
end

Instance Method Details

#members(&block) ⇒ Object



32
33
34
35
36
# File 'lib/rype/chat.rb', line 32

def members(&block)
  get_property('MEMBERS') do |member_list|
    yield member_list.split(/ /)
  end
end

#send_message(message) ⇒ Object



24
25
26
# File 'lib/rype/chat.rb', line 24

def send_message(message)
  Api.invoke("CHATMESSAGE #{@chatname} #{message}")
end

#topic(&block) ⇒ Object



28
29
30
# File 'lib/rype/chat.rb', line 28

def topic(&block)
  get_property('TOPIC', &block)
end