Sha256: 432db916fc9358ff00d344b1e85e52c00a0903a68d9b9a85b1630985291f7049
Contents?: true
Size: 412 Bytes
Versions: 5
Compression:
Stored size: 412 Bytes
Contents
module DatabaseSlave def self.configurations Configuration.new.config end # TODO 错误检查, 边界条件检查 class Configuration attr_reader :config def initialize(*) @config = database_configuration[Rails.env] end private def database_configuration require 'erb' YAML::load(ERB.new(IO.read("#{Rails.root}/config/shards.yml")).result) end end end
Version data entries
5 entries across 5 versions & 1 rubygems