Class: DatastaxRails::Cql::CreateKeyspace
- Defined in:
- lib/datastax_rails/cql/create_keyspace.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(ks_name) ⇒ CreateKeyspace
constructor
A new instance of CreateKeyspace.
- #strategy_class(sc) ⇒ Object
- #strategy_options(so) ⇒ Object
- #to_cql ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(ks_name) ⇒ CreateKeyspace
Returns a new instance of CreateKeyspace.
4 5 6 7 |
# File 'lib/datastax_rails/cql/create_keyspace.rb', line 4 def initialize(ks_name) @ks_name = ks_name @strategy_options = {} end |
Instance Method Details
#strategy_class(sc) ⇒ Object
9 10 11 12 |
# File 'lib/datastax_rails/cql/create_keyspace.rb', line 9 def strategy_class(sc) @strategy_class = sc self end |
#strategy_options(so) ⇒ Object
14 15 16 17 |
# File 'lib/datastax_rails/cql/create_keyspace.rb', line 14 def (so) @strategy_options.merge!(so) self end |
#to_cql ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/datastax_rails/cql/create_keyspace.rb', line 19 def to_cql stmt = "CREATE KEYSPACE #{@ks_name} WITH REPLICATION = {'class' : '#{@strategy_class}'" @strategy_options.each do |key, value| stmt << ", '#{key}' : '#{value}'" end stmt << '}' stmt end |