Commit 6c3249cb by liyijie

Do not need to include WeatherModuel manual, fix module define problem

parent 26461930
require 'factory_girl_rails'
require 'weather-model/version' require 'weather-model/version'
module WeatherModel
Dir[File.dirname(__FILE__) + '/weather-model/*.rb'].each { |file| require file }
require 'factory_girl_rails'
def self.included base Dir[File.dirname(__FILE__) + '/weather-model/*.rb'].each { |file| require file }
::WeatherModel::SourceSchema.sorts.each { |sort| ::WeatherModel.const_set(sort, Module.new)}
::WeatherModel::SourceSchema.constants.each do |source|
settings = ::WeatherModel::SourceSchema.const_get(source)
::WeatherModel.const_get(settings[:sort]).const_set(source, Class.new(Storer::Mysql)).use_settings(settings)
end
end
module WeatherModel
def self.set_ohm redis def self.set_ohm redis
Ohm.redis = redis Ohm.redis = redis
end end
end end
WeatherModel::SourceSchema.sorts.each { |sort| WeatherModel.const_set(sort, Module.new)}
WeatherModel::SourceSchema.constants.each do |source|
settings = WeatherModel::SourceSchema.const_get(source)
WeatherModel.const_get(settings[:sort]).const_set(source, Class.new(WeatherModel::Storer::Mysql)).use_settings(settings)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment