Class: Flamethrower::Irc::Channel
- Inherits:
-
Object
- Object
- Flamethrower::Irc::Channel
- Defined in:
- lib/flamethrower/irc/channel.rb
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#modes ⇒ Object
Returns the value of attribute modes.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, campfire_channel = nil) ⇒ Channel
constructor
A new instance of Channel.
- #retrieve_irc_messages ⇒ Object
- #to_campfire ⇒ Object
- #topic ⇒ Object
- #topic=(topic) ⇒ Object
- #users ⇒ Object
- #users=(users) ⇒ Object
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
#mode ⇒ Object
Returns the value of attribute mode.
5 6 7 |
# File 'lib/flamethrower/irc/channel.rb', line 5 def mode @mode end |
#modes ⇒ Object
Returns the value of attribute modes.
5 6 7 |
# File 'lib/flamethrower/irc/channel.rb', line 5 def modes @modes end |
#name ⇒ Object
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_messages ⇒ Object
40 41 42 43 44 45 |
# File 'lib/flamethrower/irc/channel.rb', line 40 def to_campfire..inject([]) do |, | << .to_irc if () end end |
#to_campfire ⇒ Object
28 29 30 |
# File 'lib/flamethrower/irc/channel.rb', line 28 def to_campfire @campfire_channel end |
#topic ⇒ Object
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 |
#users ⇒ Object
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 |