Module: Cassie::Connection::ClassMethods

Included in:
Cassie::Connection, Query
Defined in:
lib/cassie/connection.rb

Instance Method Summary collapse

Instance Method Details

#keyspace(val = NilClass) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cassie/connection.rb', line 20

def keyspace(val=NilClass)
  # support DSL style
  # class Foo
  #   include Cassie::Connection
  #   keyspace :foo
  # end
  if val == NilClass
    # regular getter behavior
    return @keyspace if defined?(@keyspace)
    # fall back to global default when not
    # defined for class
    Cassie.keyspace
  else
    # DSL style set
    self.keyspace = val
  end
end

#keyspace=(val) ⇒ Object


38
39
40
41
# File 'lib/cassie/connection.rb', line 38

def keyspace=(val)
  #support non DSL style Class.keyspace = :foo
  @keyspace = val
end