Class: IRCHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/rhuidean/stateful_client.rb

Overview

So we don’t have to do @channels constantly

Instance Method Summary collapse

Constructor Details

#initialize(casemapping) ⇒ IRCHash

Returns a new instance of IRCHash.



306
307
308
309
310
# File 'lib/rhuidean/stateful_client.rb', line 306

def initialize(casemapping)
    @casemapping = casemapping

    super()
end

Instance Method Details

#[](key) ⇒ Object



312
313
314
315
# File 'lib/rhuidean/stateful_client.rb', line 312

def [](key)
    key = irc_downcase(key)
    super(key)
end

#[]=(key, value) ⇒ Object



317
318
319
320
# File 'lib/rhuidean/stateful_client.rb', line 317

def []=(key, value)
    key = irc_downcase(key)
    super(key, value)
end

#irc_downcase(string) ⇒ Object



322
323
324
325
326
327
328
# File 'lib/rhuidean/stateful_client.rb', line 322

def irc_downcase(string)
    if @casemapping == :rfc
        string.downcase.tr('{}|^', '[]\\~')
    else
        string.downcase
    end
end