Sha256: 0ee59193d38dcfcd47b6aba3643f718ccb0cb3d331f23728d0bec8dc6a1e2817
Contents?: true
Size: 731 Bytes
Versions: 1
Compression:
Stored size: 731 Bytes
Contents
module Dbcp class Database class UnsupportedDatabaseAdapter < StandardError; end class << self def build(args) klass_for_adapter(args['adapter']).new args end def klass_for_adapter(adapter) klass = case adapter when /mysql/ MysqlDatabase when /postgres/ PostgresDatabase else raise UnsupportedDatabaseAdapter.new("Unsupported database adapter: #{adapter}") end end end include Virtus.value_object values do attribute :adapter attribute :database attribute :host, String, default: 'localhost' attribute :socket attribute :username attribute :password end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dbcp-0.0.1 | lib/dbcp/database.rb |