Module: Friendly

Defined in:
lib/friendly/uuid.rb,
lib/friendly.rb,
lib/friendly/cache.rb,
lib/friendly/index.rb,
lib/friendly/query.rb,
lib/friendly/scope.rb,
lib/friendly/table.rb,
lib/friendly/boolean.rb,
lib/friendly/indexer.rb,
lib/friendly/storage.rb,
lib/friendly/document.rb,
lib/friendly/attribute.rb,
lib/friendly/memcached.rb,
lib/friendly/data_store.rb,
lib/friendly/translator.rb,
lib/friendly/cache/by_id.rb,
lib/friendly/scope_proxy.rb,
lib/friendly/associations.rb,
lib/friendly/storage_proxy.rb,
lib/friendly/table_creator.rb,
lib/friendly/document/mixin.rb,
lib/friendly/document_table.rb,
lib/friendly/storage_factory.rb,
lib/friendly/associations/set.rb,
lib/friendly/document/scoping.rb,
lib/friendly/document/storage.rb,
lib/friendly/document/attributes.rb,
lib/friendly/document/convenience.rb,
lib/friendly/document/associations.rb,
lib/friendly/associations/association.rb

Overview

This class was extracted from the cassandra gem by Evan Weaver As such, it is distributed under the terms of the apache license. See the APACHE-LICENSE file in the root of this project for more information.

Defined Under Namespace

Modules: Associations, Boolean, Document Classes: Attribute, Cache, DataStore, DocumentTable, Error, Index, Indexer, Memcached, MissingIndex, NoConverterExists, NotSupported, Query, RecordNotFound, Scope, ScopeProxy, Storage, StorageFactory, StorageProxy, Table, TableCreator, Translator, UUID

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cacheObject

Returns the value of attribute cache.



25
26
27
# File 'lib/friendly.rb', line 25

def cache
  @cache
end

.datastoreObject

Returns the value of attribute datastore.



25
26
27
# File 'lib/friendly.rb', line 25

def datastore
  @datastore
end

.dbObject

Returns the value of attribute db.



25
26
27
# File 'lib/friendly.rb', line 25

def db
  @db
end

Class Method Details

.batchObject



32
33
34
35
36
37
38
39
40
# File 'lib/friendly.rb', line 32

def batch
  begin
    datastore.start_batch
    yield
    datastore.flush_batch
  ensure
    datastore.reset_batch
  end
end

.configure(config) ⇒ Object



27
28
29
30
# File 'lib/friendly.rb', line 27

def configure(config)
  self.db        = Sequel.connect(config)
  self.datastore = DataStore.new(db)
end

.create_tables!Object



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

def create_tables!
  Document.create_tables!
end