Class: CassandraMigrations::Cassandra::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra_migrations/cassandra/query_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(cql_query_result) ⇒ QueryResult

Returns a new instance of QueryResult.



7
8
9
# File 'lib/cassandra_migrations/cassandra/query_result.rb', line 7

def initialize(cql_query_result)
  @cql_query_result = cql_query_result
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

Delegates all other method calls to the lower level query result (Cql::Client::QueryResult)



27
28
29
# File 'lib/cassandra_migrations/cassandra/query_result.rb', line 27

def method_missing(name, *args, &block)
  @cql_query_result.send(name, *args, &block)
end

Instance Method Details

#inspectObject

We don’t want to flood the console or the log with an inspection of a lot of loaded data



13
14
15
# File 'lib/cassandra_migrations/cassandra/query_result.rb', line 13

def inspect
  "#<CassandraMigrations::Cassandra::QueryResult:#{object_id}>"
end

#metadataObject

Returns => :column_type hash



18
19
20
21
22
23
24
# File 'lib/cassandra_migrations/cassandra/query_result.rb', line 18

def 
  hash = {}
  @cql_query_result..each do ||
    hash[.column_name] = .type   
  end
  hash
end