Project

General

Profile

« Previous | Next » 

Revision 41310a41

Added by Marc Dequènes over 10 years ago

View differences:

lib/cyborghood/base/config.rb
CONFFILE_GLOBAL = "cyborghood.conf"
CONFFILE_BOT = "cyborghood_%s.conf"
# class variable SUX
class << self; attr_accessor :theconfig; end
def self.load(name = nil)
# load all config parts
g_config_raw = load_config_raw()
......
end
# create config object for easier access
@@config = config.to_ostruct.freeze
self.theconfig = config.to_ostruct.freeze
end
def method_missing(sym, *args, &block)
begin
@@config.send sym, *args, &block
self.class.theconfig.send sym, *args, &block
rescue
nil
end
lib/cyborghood/mail.rb
class Mail < Delegator
include I18nTranslation
# class variable SUX
class << self; attr_accessor :delivery_initialized; end
attr_accessor :user, :signature_timestamp
def initialize(msg = nil)
......
end
def deliver
unless @@delivery_initialized
unless self.class.delivery_initialized
Mail.defaults do
delivery_method :smtp, {
:address => @config.mail.smtp_server,
......
}
end
@@delivery_initialized = true
self.class.delivery_initialized = true
end
@mail.deliver

Also available in: Unified diff