Sha256: 0ef68a72d6f380ae0d259b92e548e31d29308bcec5f9e2d7ffef8d2bf78c7e26
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
require 'rype/events' module Rype class Chat class << self attr_accessor :chats def all chats if chats Api.invoke("SEARCH CHATS") sleep 0.01 while chats.nil? yield chats end end attr_reader :chatname def initialize(chatname) @chatname = chatname end def send_message(message) Api.invoke("CHATMESSAGE #{@chatname} #{message}") end def topic(&block) get_property('TOPIC', &block) end def members(&block) get_property('MEMBERS') do |member_list| yield member_list.split(/ /) end end private def get_property(property, &block) return unless block_given? Api.invoke("GET CHAT #{chatname} #{property}") do |message| yield message.split[3..-1].join(' ') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rype-0.0.2 | lib/rype/chat.rb |