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



24
25
26
27
# File 'lib/cinch/channel_list.rb', line 24

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



13
14
15
16
17
18
# File 'lib/cinch/channel_list.rb', line 13

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