Class: Cinch::ChannelList

Inherits:
CachedList show all
Defined in:
lib/cinch/channel_list.rb

Overview

Note:

In prior versions, this class was called ChannelManager

Since:

  • 2.0.0

Version:

  • 1.1.0

Instance Method Summary collapse

Methods inherited from CachedList

#each, #initialize

Constructor Details

This class inherits a constructor from Cinch::CachedList

Instance Method Details

#find(name) ⇒ Channel?

Finds a channel.

Parameters:

  • name (String)

    name of a channel

Returns:

Since:

  • 2.0.0



26
27
28
29
# File 'lib/cinch/channel_list.rb', line 26

def find(name)
  downcased_name = name.irc_downcase(@bot.irc.isupport["CASEMAPPING"])
  @cache[downcased_name]
end

#find_ensured(name) ⇒ Channel

Finds or creates a channel.

Parameters:

  • name (String)

    name of a channel

Returns:

See Also:

Since:

  • 2.0.0



15
16
17
18
19
20
# File 'lib/cinch/channel_list.rb', line 15

def find_ensured(name)
  downcased_name = name.irc_downcase(@bot.irc.isupport["CASEMAPPING"])
  @mutex.synchronize do
    @cache[downcased_name] ||= Channel.new(name, @bot)
  end
end