class UnicodePlugin

Public Class Methods

new(*a) click to toggle source
Calls superclass method
# File lib/rbot/core/unicode.rb, line 67
def initialize(*a)
    super
    @@old_kcode = $KCODE
    self.class.reconfigure_filter(@bot)
end
reconfigure_filter(bot) click to toggle source
# File lib/rbot/core/unicode.rb, line 80
def UnicodePlugin.reconfigure_filter(bot)
    debug "configuring encodings"
    enable = bot.config['encoding.enable']
    if not enable
        bot.socket.filter = nil
        $KCODE = @@old_kcode
        return
    end
    charsets = bot.config['encoding.charsets']
    charsets = ['utf-8'] if charsets.empty?
    bot.socket.filter = UnicodeFilter.new(charsets[0], *charsets)
    $KCODE = 'u'
end

Public Instance Methods

cleanup() click to toggle source
Calls superclass method
# File lib/rbot/core/unicode.rb, line 73
def cleanup
    debug "cleaning up encodings"
    @bot.socket.filter = nil
    $KCODE = @@old_kcode
    super
end