Class: ROM::Cassandra::Session
- Inherits:
-
Object
- Object
- ROM::Cassandra::Session
- Defined in:
- lib/rom/cassandra/session.rb
Overview
Wraps the external driver, responsible for sending CQL requests to the Cassandra cluster
Constant Summary collapse
- FORMAT =
The regexp, describing the format of the allowed address of the cluster
/\d{1,3}(\.\d{1,3}){3}(\:\d+)?/
Instance Attribute Summary collapse
-
#uri ⇒ Hash
readonly
The settings for the session.
Instance Method Summary collapse
-
#call(query) ⇒ Array<Hash>
Sends the query to the Cassandra syncronously.
-
#initialize(*options) ⇒ Session
constructor
Initializes a session to given cluster.
Constructor Details
#initialize(*options) ⇒ Session
Initializes a session to given cluster
25 26 27 28 |
# File 'lib/rom/cassandra/session.rb', line 25 def initialize(*) @uri = extract(*) @conn = ::Cassandra.cluster(uri).connect end |
Instance Attribute Details
#uri ⇒ Hash (readonly)
Returns the settings for the session.
19 20 21 |
# File 'lib/rom/cassandra/session.rb', line 19 def uri @uri end |
Instance Method Details
#call(query) ⇒ Array<Hash>
Sends the query to the Cassandra syncronously
36 37 38 |
# File 'lib/rom/cassandra/session.rb', line 36 def call(query) @conn.execute(query.to_s).to_a end |