Commit 81bfe2ad by liyijie

Merge branch 'liyijie/module_define' into 'master'

Do not need to include WeatherModuel manual, fix module define problem See merge request !7
parents 26461930 6c3249cb
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 } Dir[File.dirname(__FILE__) + '/weather-model/*.rb'].each { |file| require file }
require 'factory_girl_rails'
def self.included base
::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