Sha256: e64eaa1bec52d051fa8cae0831f5bcae612aa6157f759c76aa7ca2414cf89aa8
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
module Dbcp class Database class BlankDatabaseDefinition < StandardError; end 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 when nil, '' raise BlankDatabaseDefinition.new("No database adapter was provided.") 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 :port, Fixnum attribute :socket attribute :username attribute :password end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dbcp-0.2.1 | lib/dbcp/database.rb |
dbcp-0.2.0 | lib/dbcp/database.rb |
dbcp-0.1.0 | lib/dbcp/database.rb |