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/config.rb,
lib/friendly/boolean.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/named_scope.rb,
lib/friendly/scope_proxy.rb,
lib/friendly/associations.rb,
lib/friendly/storage_proxy.rb,
lib/friendly/table_creator.rb,
lib/friendly/document_table.rb,
lib/friendly/storage_factory.rb,
lib/friendly/associations/set.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, Config, DataStore, DocumentTable, Error, Index, Memcached, MissingIndex, NamedScope, 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.



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

def cache
  @cache
end

.datastoreObject

Returns the value of attribute datastore.



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

def datastore
  @datastore
end

.dbObject

Returns the value of attribute db.



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

def db
  @db
end

Class Method Details

.batchObject



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

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

.configure(config) ⇒ Object



29
30
31
32
# File 'lib/friendly.rb', line 29

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

.create_tables!Object



44
45
46
# File 'lib/friendly.rb', line 44

def create_tables!
  Document.create_tables!
end