Sha256: b43e97cb2d8361a9a5037c9a433eb4a1d9506e4534671055e749c21f6c63fd18
Contents?: true
Size: 842 Bytes
Versions: 5
Compression:
Stored size: 842 Bytes
Contents
require 'cassanity/argument_generators/with_clause' module Cassanity module ArgumentGenerators class KeyspaceCreate def initialize(args = {}) @with_clause = args.fetch(:with_clause) { WithClause.new } end # Internal def call(args = {}) options, variables = [], [] name = args.fetch(:keyspace_name) cql = "CREATE KEYSPACE #{name}" replication = default_replication_options.merge(args[:replication] || {}) with_cql, *with_variables = @with_clause.call(with: { replication: replication }) cql << with_cql variables.concat(with_variables) [cql, *variables] end # Private def default_replication_options { class: 'SimpleStrategy', replication_factor: 1, } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems