Class: Cassanity::ArgumentGenerators::Columns
- Inherits:
-
Object
- Object
- Cassanity::ArgumentGenerators::Columns
- Defined in:
- lib/cassanity/argument_generators/columns.rb
Instance Method Summary collapse
-
#call(args = {}) ⇒ Object
Internal.
-
#initialize(args = {}) ⇒ Columns
constructor
A new instance of Columns.
Constructor Details
#initialize(args = {}) ⇒ Columns
7 8 9 |
# File 'lib/cassanity/argument_generators/columns.rb', line 7 def initialize(args = {}) @where_clause = args.fetch(:where_clause) { WhereClause.new } end |
Instance Method Details
#call(args = {}) ⇒ Object
Internal
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cassanity/argument_generators/columns.rb', line 12 def call(args = {}) where = {} variables = [] cql = 'SELECT * FROM system.schema_columns' if (keyspace_name = args[:keyspace_name]) where[:keyspace_name] = keyspace_name end if (column_family_name = args[:column_family_name]) where[:columnfamily_name] = column_family_name end where_cql, *where_variables = @where_clause.call(where: where) cql << where_cql variables.concat(where_variables) [cql, *variables] end |