Class | Irc::Casemap |
In: |
lib/rbot/irc.rb
|
Parent: | Object |
Due to its Scandinavian origins, IRC has strange case mappings, which consider the characters {}|^ as the uppercase equivalents of # []\~.
This is however not the same on all IRC servers: some use standard ASCII casemapping, other do not consider ^ as the uppercase of ~
Create a new casemap with name name, uppercase characters upper and lowercase characters lower
# File lib/rbot/irc.rb, line 74 74: def initialize(name, upper, lower) 75: @key = name.to_sym 76: raise "Casemap #{name.inspect} already exists!" if @@casemaps.has_key?(@key) 77: @@casemaps[@key] = { 78: :upper => upper, 79: :lower => lower, 80: :casemap => self 81: } 82: end
Give a warning if arg and self are not the same Casemap
# File lib/rbot/irc.rb, line 129 129: def must_be(arg) 130: other = arg.to_irc_casemap 131: if self == other 132: return true 133: else 134: warn "Casemap mismatch (#{self.inspect} != #{other.inspect})" 135: return false 136: end 137: end