Class: ROM::Cassandra::Dataset Private
- Inherits:
-
Object
- Object
- ROM::Cassandra::Dataset
- Includes:
- Enumerable
- Defined in:
- lib/rom/cassandra/dataset.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The dataset describes a table of the Cassandra cluster
Instance Attribute Summary collapse
-
#keyspace ⇒ Symbol
readonly
private
The name of the current keyspace.
-
#query ⇒ QueryBuilder::Statement
readonly
private
The lazy query to the current table.
-
#session ⇒ ROM::Cassandra::Session
readonly
private
The open session to a Cassandra cluster.
-
#table ⇒ Symbol
readonly
private
The name of the current table.
Instance Method Summary collapse
-
#batch ⇒ ROM::Relation::Dataset
private
Returns the new dataset carriyng the batch query.
-
#each {|tuples| ... } ⇒ Enumerator
private
Sends the [#query] to Cassandra and iterates through results.
-
#get(*args) ⇒ ROM::Relation::Dataset
private
Returns new dataset with `select` method applied to the [#query].
-
#initialize(session, keyspace, table, query = nil) ⇒ Dataset
constructor
private
Initializes the dataset for given column family and command options.
Constructor Details
#initialize(session, keyspace, table, query = nil) ⇒ Dataset
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the dataset for given column family and command options
47 48 49 50 51 52 |
# File 'lib/rom/cassandra/dataset.rb', line 47 def initialize(session, keyspace, table, query = nil) @session = session @keyspace = keyspace.to_sym if keyspace @table = table.to_sym if table @query = query || Query.new.keyspace(keyspace).table(table) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
92 93 94 |
# File 'lib/rom/cassandra/dataset.rb', line 92 def method_missing(name, *args) reload keyspace, table, query.public_send(name, *args) end |
Instance Attribute Details
#keyspace ⇒ Symbol (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The name of the current keyspace.
24 25 26 |
# File 'lib/rom/cassandra/dataset.rb', line 24 def keyspace @keyspace end |
#query ⇒ QueryBuilder::Statement (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The lazy query to the current table.
36 37 38 |
# File 'lib/rom/cassandra/dataset.rb', line 36 def query @query end |
#session ⇒ ROM::Cassandra::Session (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The open session to a Cassandra cluster.
18 19 20 |
# File 'lib/rom/cassandra/dataset.rb', line 18 def session @session end |
#table ⇒ Symbol (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The name of the current table.
30 31 32 |
# File 'lib/rom/cassandra/dataset.rb', line 30 def table @table end |
Instance Method Details
#batch ⇒ ROM::Relation::Dataset
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the new dataset carriyng the batch query
The batch query doesn't restricted by any table or keyspace
60 61 62 |
# File 'lib/rom/cassandra/dataset.rb', line 60 def batch reload nil, nil, Query.new.batch end |
#each {|tuples| ... } ⇒ Enumerator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sends the [#query] to Cassandra and iterates through results
81 82 83 84 |
# File 'lib/rom/cassandra/dataset.rb', line 81 def each return to_enum unless block_given? session.call(query).each { |item| yield(item) } end |
#get(*args) ⇒ ROM::Relation::Dataset
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns new dataset with `select` method applied to the [#query]
70 71 72 |
# File 'lib/rom/cassandra/dataset.rb', line 70 def get(*args) reload keyspace, table, query.select(*args) end |