Class: Irc::Channel::Topic
Overview
A Topic represents the topic of a channel. It consists of the topic itself, who set it and when
Instance Attribute Summary collapse
-
#set_by ⇒ Object
Returns the value of attribute set_by.
-
#set_on ⇒ Object
Returns the value of attribute set_on.
-
#text ⇒ Object
(also: #to_s)
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text = "", set_by = "", set_on = Time.new) ⇒ Topic
constructor
Create a new Topic setting the text, the creator and the creation time.
-
#replace(topic) ⇒ Object
Replace a Topic with another one.
-
#to_irc_channel_topic ⇒ Object
Returns self.
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_by ⇒ Object
Returns the value of attribute set_by.
1280 1281 1282 |
# File 'lib/rbot/irc.rb', line 1280 def set_by @set_by end |
#set_on ⇒ Object
Returns the value of attribute set_on.
1280 1281 1282 |
# File 'lib/rbot/irc.rb', line 1280 def set_on @set_on end |
#text ⇒ Object 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
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_topic ⇒ Object
Returns self
1303 1304 1305 |
# File 'lib/rbot/irc.rb', line 1303 def to_irc_channel_topic self end |