Module: Virsandra

Defined in:
lib/virsandra.rb,
lib/virsandra/model.rb,
lib/virsandra/query.rb,
lib/virsandra/errors.rb,
lib/virsandra/version.rb,
lib/virsandra/cql_value.rb,
lib/virsandra/connection.rb,
lib/virsandra/model_query.rb,
lib/virsandra/configuration.rb,
lib/virsandra/queries/add_query.rb,
lib/virsandra/queries/alter_query.rb,
lib/virsandra/queries/limit_query.rb,
lib/virsandra/queries/order_query.rb,
lib/virsandra/queries/table_query.rb,
lib/virsandra/queries/where_query.rb,
lib/virsandra/queries/delete_query.rb,
lib/virsandra/queries/insert_query.rb,
lib/virsandra/queries/select_query.rb,
lib/virsandra/queries/values_query.rb

Defined Under Namespace

Modules: Model Classes: AddQuery, AlterQuery, CQLValue, Configuration, ConfigurationError, Connection, DeleteQuery, InsertQuery, InvalidQuery, LimitQuery, ModelQuery, OrderQuery, Query, SelectQuery, TableQuery, ValuesQuery, WhereQuery

Constant Summary collapse

VERSION =
"0.5.1"

Class Method Summary collapse

Class Method Details

.configurationObject


14
15
16
# File 'lib/virsandra.rb', line 14

def configuration
  Thread.current[:configuration] ||= Virsandra::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:


18
19
20
# File 'lib/virsandra.rb', line 18

def configure
  yield configuration
end

.connectionObject


22
23
24
25
26
27
28
29
# File 'lib/virsandra.rb', line 22

def connection
  if dirty?
    disconnect!
    Thread.current[:connection] = Virsandra::Connection.new(configuration)
    configuration.accept_changes
  end
  Thread.current[:connection]
end

.consistencyObject


46
47
48
# File 'lib/virsandra.rb', line 46

def consistency
  configuration.consistency
end

.consistency=(value) ⇒ Object


58
59
60
# File 'lib/virsandra.rb', line 58

def consistency=(value)
  configuration.consistency = value
end

.disconnect!Object


31
32
33
34
35
36
# File 'lib/virsandra.rb', line 31

def disconnect!
  if Thread.current[:connection].respond_to?(:disconnect!)
    Thread.current[:connection].disconnect!
  end
  Thread.current[:connection] = nil
end

.execute(query) ⇒ Object


70
71
72
# File 'lib/virsandra.rb', line 70

def execute(query)
  connection.execute(query)
end

.keyspaceObject


50
51
52
# File 'lib/virsandra.rb', line 50

def keyspace
  configuration.keyspace
end

.keyspace=(value) ⇒ Object


62
63
64
# File 'lib/virsandra.rb', line 62

def keyspace=(value)
  configuration.keyspace = value
end

.reset!Object


38
39
40
# File 'lib/virsandra.rb', line 38

def reset!
  configuration.reset!
end

.reset_configuration!Object


42
43
44
# File 'lib/virsandra.rb', line 42

def reset_configuration!
  Thread.current[:configuration] = nil
end

.serversObject


54
55
56
# File 'lib/virsandra.rb', line 54

def servers
  configuration.servers
end

.servers=(value) ⇒ Object


66
67
68
# File 'lib/virsandra.rb', line 66

def servers=(value)
  configuration.servers = value
end