Methods
Attributes
[RW] config_file
Public Class methods
new()
     # File server/master_worker.rb, line 127
127:     def initialize
128:       raise "Running old Ruby version, upgrade to Ruby >= 1.8.5" unless check_for_ruby_version
129:       @config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/config/backgroundrb.yml")).result)
130:       debug_logger = DebugMaster.new(@config_file[:backgroundrb][:log])
131: 
132:       load_rails_env
133:       Packet::Reactor.run do |t_reactor|
134:         enable_memcache_result_hash(t_reactor) if @config_file[:backgroundrb][:result_storage] && @config_file[:backgroundrb][:result_storage][:memcache]
135:         t_reactor.start_worker(:worker => :log_worker)
136:         t_reactor.start_server(@config_file[:backgroundrb][:ip],@config_file[:backgroundrb][:port],MasterWorker) { |conn|  conn.debug_logger = debug_logger }
137:       end
138:     end
Public Instance methods
check_for_ruby_version()
     # File server/master_worker.rb, line 164
164:     def check_for_ruby_version; return RUBY_VERSION >= "1.8.5"; end
enable_memcache_result_hash(t_reactor)
     # File server/master_worker.rb, line 149
149:     def enable_memcache_result_hash(t_reactor)
150:       require 'memcache'
151:       memcache_options = {
152:         :c_threshold => 10_000,
153:         :compression => true,
154:         :debug => false,
155:         :namespace => 'backgroundrb_result_hash',
156:         :readonly => false,
157:         :urlencode => false
158:       }
159:       cache = MemCache.new(memcache_options)
160:       cache.servers = @config_file[:backgroundrb][:result_storage][:memcache].split(',')
161:       t_reactor.set_result_hash(cache)
162:     end
load_rails_env()
     # File server/master_worker.rb, line 140
140:     def load_rails_env
141:       db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/config/database.yml")).result)
142:       run_env = @config_file[:backgroundrb][:environment] || 'development'
143:       ENV["RAILS_ENV"] = run_env
144:       RAILS_ENV.replace(run_env) if defined?(RAILS_ENV)
145:       require RAILS_HOME + '/config/environment.rb'
146:       ActiveRecord::Base.allow_concurrency = true
147:     end