Sha256: ab0dfddd8d2ecac58b0be245f90792388b1fb667c7a4c9d5a41223b8d218bd42
Contents?: true
Size: 886 Bytes
Versions: 4
Compression:
Stored size: 886 Bytes
Contents
module PgHero module Methods module Databases def databases @databases ||= begin Hash[ config["databases"].map do |id, c| [id, PgHero::Database.new(id, c)] end ] end end def primary_database databases.keys.first end def current_database Thread.current[:pghero_current_database] ||= primary_database end def current_database=(database) raise "Database not found" unless databases[database.to_s] Thread.current[:pghero_current_database] = database.to_s database end def with(database) previous_database = current_database begin self.current_database = database yield ensure self.current_database = previous_database end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pghero-1.4.2 | lib/pghero/methods/databases.rb |
pghero-1.4.1 | lib/pghero/methods/databases.rb |
pghero-1.4.0 | lib/pghero/methods/databases.rb |
pghero-1.3.2 | lib/pghero/methods/databases.rb |