Class: Irc::Channel::Topic

Inherits:
Object show all
Defined in:
/home/apoc/projects/ruby/rbot/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

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

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



1286
1287
1288
1289
1290
# File '/home/apoc/projects/ruby/rbot/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

- (Object) set_by

Returns the value of attribute set_by



1280
1281
1282
# File '/home/apoc/projects/ruby/rbot/lib/rbot/irc.rb', line 1280

def set_by
  @set_by
end

- (Object) set_on

Returns the value of attribute set_on



1280
1281
1282
# File '/home/apoc/projects/ruby/rbot/lib/rbot/irc.rb', line 1280

def set_on
  @set_on
end

- (Object) text Also known as: to_s

Returns the value of attribute text



1280
1281
1282
# File '/home/apoc/projects/ruby/rbot/lib/rbot/irc.rb', line 1280

def text
  @text
end

Instance Method Details

- (Object) replace(topic)

Replace a Topic with another one

Raises:

  • (TypeError)


1294
1295
1296
1297
1298
1299
# File '/home/apoc/projects/ruby/rbot/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

- (Object) to_irc_channel_topic

Returns self



1303
1304
1305
# File '/home/apoc/projects/ruby/rbot/lib/rbot/irc.rb', line 1303

def to_irc_channel_topic
  self
end