Module: Jabbot

Defined in:
lib/jabbot.rb,
lib/jabbot/bot.rb,
lib/jabbot/config.rb,
lib/jabbot/macros.rb,
lib/jabbot/version.rb,
lib/jabbot/handlers.rb

Defined Under Namespace

Modules: Handlers, Macros Classes: Bot, Config, Handler, Message

Constant Summary collapse

DEFAULT_CONFIG =

Default configuration values. If an option is not set on creation, it gets the default value instead.

{
  :login            => nil,
  :password         => nil,
  :nick             => 'jabbot',
  :server           => nil,
  :channel          => nil,
  :channel_password => nil,
  :resource         => 'jabbot',
  :log_level        => 'info',
  :log_file         => nil,
  :debug            => false
}
VERSION =
'1.0.0'
@@app_file =
lambda do
  ignore = [
    /lib\/twibot.*\.rb/, # Library
    /\(.*\)/,            # Generated code
    /custom_require\.rb/ # RubyGems require
  ]
   path = caller.map { |line| line.split(/:\d/, 2).first }.find do |file|
    next if ignore.any? { |pattern| file =~ pattern }
    file
  end
   path || $0
end.call

Class Method Summary collapse

Class Method Details

.app_fileObject

Public: File name of the application file (inspired by Sinatra).

Returns the String application filename.



34
35
36
# File 'lib/jabbot.rb', line 34

def self.app_file
  @@app_file
end

.run?Boolean

Public: Determines if the application should be auto-run.

Returns a Boolean indicatin wether to auto-run the application or not.

Returns:

  • (Boolean)


41
42
43
# File 'lib/jabbot.rb', line 41

def self.run?
  self.app_file == $0
end