Sha256: 55d3ae92772a4a4d68a453210447217767e246c8fea5bdc32df4533976658d31
Contents?: true
Size: 806 Bytes
Versions: 6
Compression:
Stored size: 806 Bytes
Contents
module CassandraObject module Connection extend ActiveSupport::Concern included do class_attribute :connection end module ClassMethods DEFAULT_OPTIONS = { servers: "127.0.0.1:9160", } DEFAULT_THRIFT_OPTIONS = { exception_class_overrides: [], } # This doesn't open a connection. It merely conifgures the connection object. def establish_connection(config) spec = config.reverse_merge(DEFAULT_OPTIONS) spec[:thrift] = (spec[:thrift] || {}).reverse_merge(DEFAULT_THRIFT_OPTIONS) spec[:thrift][:exception_class_overrides] = spec[:thrift][:exception_class_overrides].map(&:constantize) self.connection = Cassandra.new(spec[:keyspace], spec[:servers], spec[:thrift]) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems