Class: Cinch::ChannelManager

Inherits:
CacheManager show all
Defined in:
lib/cinch/channel_manager.rb

Instance Method Summary collapse

Methods inherited from CacheManager

#each, #initialize

Constructor Details

This class inherits a constructor from Cinch::CacheManager

Instance Method Details

#find(name) ⇒ Channel?

Finds a channel.

Parameters:

  • name (String)

    name of a channel

Returns:



21
22
23
24
# File 'lib/cinch/channel_manager.rb', line 21

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:



10
11
12
13
14
15
# File 'lib/cinch/channel_manager.rb', line 10

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