Module: CassandraObject::Connection::ClassMethods

Defined in:
lib/cassandra_object/connection.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  servers: "127.0.0.1:9160",
}
DEFAULT_THRIFT_OPTIONS =
{
  exception_class_overrides: [],
}

Instance Method Summary collapse

Instance Method Details

#establish_connection(config) ⇒ Object

This doesn’t open a connection. It merely conifgures the connection object.



215
216
217
218
219
220
221
222
# File 'lib/cassandra_object/connection.rb', line 215

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_spec = spec
end