### Home Classes Methods

### In Files

- lib/rbot/load-gettext.rb
- lib/rbot/irc.rb
- lib/rbot/ircbot.rb

### Parent

BasicObject

### Methods

- #N_
- #Nn_
- #_
- #bindtextdomain_to
- #debug
- #error
- #fatal
- #halt_logger
- #log
- #log_session_end
- #log_session_start
- #n_
- #nil_or_empty?
- #pretty_inspect
- #rawlog
- #restart_logger
- #s_
- #warning

### Included Modules

- Comparable
- GetText

### Class/Module Index

Quicksearch

- Irc
- Irc::AsciiCasemap
- Irc::BanlistMessage
- Irc::BasicUserMessage
- Irc::Bot
- Irc::Bot::Auth
- Irc::Bot::Auth::BotOwnerClass
- Irc::Bot::Auth::BotUser
- Irc::Bot::Auth::Command
- Irc::Bot::Auth::DefaultBotUserClass
- Irc::Bot::Auth::InvalidPassword
- Irc::Bot::Auth::ManagerClass
- Irc::Bot::Auth::PermissionSet
- Irc::Bot::Config
- Irc::Bot::Config::ArrayValue
- Irc::Bot::Config::BooleanValue
- Irc::Bot::Config::EnumValue
- Irc::Bot::Config::FloatValue
- Irc::Bot::Config::IntegerValue
- Irc::Bot::Config::ManagerClass
- Irc::Bot::Config::StringValue
- Irc::Bot::Config::Value
- Irc::Bot::Config::Wizard
- Irc::Bot::DataFilter
- Irc::Bot::DataStream
- Irc::Bot::Language
- Irc::Bot::MessageMapper
- Irc::Bot::MessageMapper::Failure
- Irc::Bot::MessageMapper::FriendlyFailure
- Irc::Bot::MessageMapper::NoActionFailure
- Irc::Bot::MessageMapper::NoMatchFailure
- Irc::Bot::MessageMapper::NotPrivateFailure
- Irc::Bot::MessageMapper::NotPublicFailure
- Irc::Bot::MessageMapper::PartialMatchFailure
- Irc::Bot::MessageParameter
- Irc::Bot::MessageTemplate
- Irc::Bot::Plugins
- Irc::Bot::Plugins::BotModule
- Irc::Bot::Plugins::CoreBotModule
- Irc::Bot::Plugins::Plugin
- Irc::Bot::Plugins::PluginManagerClass
- Irc::Bot::Plugins::RecurseTooDeep
- Irc::Bot::Plugins::RemoteBotModule
- Irc::Bot::Plugins::RemoteCoreBotModule
- Irc::Bot::Plugins::RemotePlugin
- Irc::Bot::Registry
- Irc::Bot::Registry::Accessor
- Irc::Bot::RemoteDispatcher
- Irc::Bot::RemoteMessage
- Irc::Bot::RemoteObject
- Irc::Bot::Wordlist
- Irc::BotConfig
- Irc::Casemap
- Irc::Channel
- Irc::Channel::Mode
- Irc::Channel::ModeHash
- Irc::Channel::ModeTypeA
- Irc::Channel::ModeTypeB
- Irc::Channel::ModeTypeC
- Irc::Channel::ModeTypeD
- Irc::Channel::Topic
- Irc::Channel::UserMode
- Irc::ChannelList
- Irc::Client
- Irc::DBHash
- Irc::DBTree
- Irc::InviteMessage
- Irc::JoinMessage
- Irc::KickMessage
- Irc::MessageQueue
- Irc::ModeChangeMessage
- Irc::MotdMessage
- Irc::NamesMessage
- Irc::Netmask
- Irc::NetmaskDb
- Irc::NetmaskDb::Tree
- Irc::NetmaskList
- Irc::NickMessage
- Irc::NoSuchTargetMessage
- Irc::NoticeMessage
- Irc::PartMessage
- Irc::PrivMessage
- Irc::QueueRing
- Irc::QuitMessage
- Irc::RfcCasemap
- Irc::Server
- Irc::ServerOrCasemap
- Irc::Socket
- Irc::Socket::IdentityFilter
- Irc::StrictRfcCasemap
- Irc::TopicMessage
- Irc::UnknownMessage
- Irc::User
- Irc::UserList
- Irc::UserMessage
- Irc::Utils
- Irc::Utils::HttpUtil
- Irc::Utils::HttpUtil::CachedObject
- Irc::Utils::ParseTime
- Irc::WelcomeMessage
- Irc::WhoisMessage
- BDB
- BDB::CIBtree
- MonitorMixin
- MonitorMixin::ConditionVariable
- Net
- Net::HTTPResponse
- Regexp
- Regexp::Irc
- Singleton
- Singleton::SingletonClassMethods
- Timer
- Timer::Action
- TokyoCabinet
- TokyoCabinet::CIBDB
- UnicodePlugin
- UnicodePlugin::UnicodeFilter
- Array
- ArrayOf
- AuthModule
- BasicsModule
- ConditionVariable
- ConfigModule
- DottedIndex
- Enumerable
- Exception
- FiltersModule
- GetText
- GetTextVersionError
- HttpUtilPlugin
- IrcLogModule
- Module
- Numeric
- Object
- Range
- RemoteModule
- ServerError
- String
- Symbol
- UserDataModule
- WordlistModule
- YAML

No matching classes.

# Object

### Public Instance Methods

N_(s) click to toggle source

    # File lib/rbot/load-gettext.rb, line 128
    def N_(s)
      s
    end

Nn_(s_single, s_plural) click to toggle source

    # File lib/rbot/load-gettext.rb, line 136
    def Nn_(s_single, s_plural)
      n_(s_single, s_plural)
    end

_(s) click to toggle source

dummy functions that return msg_id without translation

    # File lib/rbot/load-gettext.rb, line 124
    def _(s)
      s
    end

bindtextdomain_to(*args) click to toggle source

    # File lib/rbot/load-gettext.rb, line 144
    def bindtextdomain_to(*args)
    end

debug(message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 107
    def debug(message=nil, who_pos=1)
      rawlog(Logger::Severity::DEBUG, message, who_pos)
    end

error(message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 119
    def error(message=nil, who_pos=1)
      rawlog(Logger::Severity::ERROR, message, who_pos)
    end

fatal(message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 123
    def fatal(message=nil, who_pos=1)
      rawlog(Logger::Severity::FATAL, message, who_pos)
    end

halt_logger() click to toggle source

    # File lib/rbot/ircbot.rb, line 72
    def halt_logger
      if $log_thread && $log_thread.alive?
        $log_queue << nil
        $log_thread.join
        $log_thread = nil
      end
    end

log(message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 111
    def log(message=nil, who_pos=1)
      rawlog(Logger::Severity::INFO, message, who_pos)
    end

log_session_end() click to toggle source

    # File lib/rbot/ircbot.rb, line 102
    def log_session_end
      $logger << "\n\n=== #{botclass} session ended on #{Time.now.strftime($dateformat)} ===\n\n"
      $log_queue << nil
    end

log_session_start() click to toggle source

    # File lib/rbot/ircbot.rb, line 97
    def log_session_start
      $logger << "\n\n=== #{botclass} session started on #{Time.now.strftime($dateformat)} ===\n\n"
      restart_logger
    end

n_(s_single, s_plural, n) click to toggle source

    # File lib/rbot/load-gettext.rb, line 132
    def n_(s_single, s_plural, n)
      n > 1 ? s_plural : s_single
    end

nil_or_empty?() click to toggle source

We extend the Object class with a method that checks if the receiver is nil or empty

    # File lib/rbot/irc.rb, line 43
    def nil_or_empty?
      return true unless self
      return true if self.respond_to? :empty? and self.empty?
      return false
    end

pretty_inspect() click to toggle source

    # File lib/rbot/ircbot.rb, line 27
    def pretty_inspect
      PP.pp(self, '')
    end

rawlog(level, message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 47
    def rawlog(level, message=nil, who_pos=1)
      call_stack = caller
      if call_stack.length > who_pos
        who = call_stack[who_pos].sub(%{(?:.+)/([^/]+):(\d+)(:in .*)?}) { "#{$1}:#{$2}#{$3}" }
      else
        who = "(unknown)"
      end
      # Output each line. To distinguish between separate messages and multi-line
      # messages originating at the same time, we blank #{who} after the first message
      # is output.
      # Also, we output strings as-is but for other objects we use pretty_inspect
      case message
      when String
        str = message
      else
        str = message.pretty_inspect
      end
      qmsg = Array.new
      str.each_line { |l|
        qmsg.push [level, l.chomp, who]
        who = ' ' * who.size
      }
      $log_queue.push qmsg
    end

restart_logger(newlogger = false) click to toggle source

    # File lib/rbot/ircbot.rb, line 82
    def restart_logger(newlogger = false)
      halt_logger

      $logger = newlogger if newlogger

      $log_thread = Thread.new do
        ls = nil
        while ls = $log_queue.pop
          ls.each { |l| $logger.add(*l) }
        end
      end
    end

s_(*args) click to toggle source

    # File lib/rbot/load-gettext.rb, line 140
    def s_(*args)
      args[0]
    end

warning(message=nil, who_pos=1) click to toggle source

    # File lib/rbot/ircbot.rb, line 115
    def warning(message=nil, who_pos=1)
      rawlog(Logger::Severity::WARN, message, who_pos)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.