Class: Cassanity::ArgumentGenerators::WithClause
- Inherits:
-
Object
- Object
- Cassanity::ArgumentGenerators::WithClause
- Defined in:
- lib/cassanity/argument_generators/with_clause.rb
Instance Method Summary collapse
-
#call(args = {}) ⇒ Object
Internal.
Instance Method Details
#call(args = {}) ⇒ Object
Internal
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cassanity/argument_generators/with_clause.rb', line 6 def call(args = {}) with = args[:with] cql = '' return [cql] if with.nil? || with.empty? variables, withs = [], [] with.each do |key, value| if key == :compact_storage if value withs << "COMPACT STORAGE" end else withs << "#{key} = ?" variables << value end end cql << " WITH #{withs.join(' AND ')}" [cql, *variables] end |