Class: Flamethrower::Irc::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/flamethrower/irc/channel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, campfire_channel = nil) ⇒ Channel

Returns a new instance of Channel.



7
8
9
10
11
12
# File 'lib/flamethrower/irc/channel.rb', line 7

def initialize(name, campfire_channel=nil)
  @users = []
  @name = name
  @modes = ["t"]
  @campfire_channel = campfire_channel
end

Instance Attribute Details

#modeObject

Returns the value of attribute mode.



5
6
7
# File 'lib/flamethrower/irc/channel.rb', line 5

def mode
  @mode
end

#modesObject

Returns the value of attribute modes.



5
6
7
# File 'lib/flamethrower/irc/channel.rb', line 5

def modes
  @modes
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/flamethrower/irc/channel.rb', line 5

def name
  @name
end

Instance Method Details

#retrieve_irc_messagesObject



40
41
42
43
44
45
# File 'lib/flamethrower/irc/channel.rb', line 40

def retrieve_irc_messages
  to_campfire.retrieve_messages.inject([]) do |all_messages, message|
    all_messages << message.to_irc if display_message?(message)
    all_messages
  end
end

#to_campfireObject



28
29
30
# File 'lib/flamethrower/irc/channel.rb', line 28

def to_campfire
  @campfire_channel
end

#topicObject



18
19
20
21
22
# File 'lib/flamethrower/irc/channel.rb', line 18

def topic
  campfire_topic = to_campfire.topic
  return "No topic" if campfire_topic && campfire_topic.empty?
  campfire_topic
end

#topic=(topic) ⇒ Object



24
25
26
# File 'lib/flamethrower/irc/channel.rb', line 24

def topic=(topic)
  to_campfire.topic = topic 
end

#usersObject



36
37
38
# File 'lib/flamethrower/irc/channel.rb', line 36

def users
  @users.concat(@campfire_channel.users.map(&:to_irc))
end

#users=(users) ⇒ Object



32
33
34
# File 'lib/flamethrower/irc/channel.rb', line 32

def users=(users)
  @users = users
end