Class: Irc::Channel::Topic

Inherits:
Object show all
Defined in:
lib/rbot/irc.rb

Overview

A Topic represents the topic of a channel. It consists of the topic itself, who set it and when

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text = "", set_by = "", set_on = Time.new) ⇒ Topic

Create a new Topic setting the text, the creator and the creation time



1286
1287
1288
1289
1290
# File 'lib/rbot/irc.rb', line 1286

def initialize(text="", set_by="", set_on=Time.new)
  @text = text
  @set_by = set_by.to_irc_netmask
  @set_on = set_on
end

Instance Attribute Details

#set_byObject

Returns the value of attribute set_by.



1280
1281
1282
# File 'lib/rbot/irc.rb', line 1280

def set_by
  @set_by
end

#set_onObject

Returns the value of attribute set_on.



1280
1281
1282
# File 'lib/rbot/irc.rb', line 1280

def set_on
  @set_on
end

#textObject Also known as: to_s

Returns the value of attribute text.



1280
1281
1282
# File 'lib/rbot/irc.rb', line 1280

def text
  @text
end

Instance Method Details

#replace(topic) ⇒ Object

Replace a Topic with another one

Raises:

  • (TypeError)


1294
1295
1296
1297
1298
1299
# File 'lib/rbot/irc.rb', line 1294

def replace(topic)
  raise TypeError, "#{topic.inspect} is not of class #{self.class}" unless topic.kind_of?(self.class)
  @text = topic.text.dup
  @set_by = topic.set_by.dup
  @set_on = topic.set_on.dup
end

#to_irc_channel_topicObject

Returns self



1303
1304
1305
# File 'lib/rbot/irc.rb', line 1303

def to_irc_channel_topic
  self
end