Sha256: e23abafa75568484a757ce75939d86f4bb29edac09df1303666aef16651d93f5

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require 'friendly/associations'
require 'friendly/attribute'
require 'friendly/boolean'
require 'friendly/cache'
require 'friendly/cache/by_id'
require 'friendly/data_store'
require 'friendly/document'
require 'friendly/document_table'
require 'friendly/index'
require 'friendly/indexer'
require 'friendly/memcached'
require 'friendly/query'
require 'friendly/sequel_monkey_patches'
require 'friendly/scope'
require 'friendly/scope_proxy'
require 'friendly/storage_factory'
require 'friendly/storage_proxy'
require 'friendly/translator'
require 'friendly/uuid'

require 'json/ext'
require 'will_paginate/collection'

module Friendly
  class << self
    attr_accessor :datastore, :db, :cache

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

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

    def create_tables!
      Document.create_tables!
    end
  end

  class Error < RuntimeError; end
  class RecordNotFound < Error; end
  class MissingIndex < Error; end
  class NoConverterExists < Friendly::Error; end
  class NotSupported < Friendly::Error; end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
wego-friendly-0.5.1 lib/friendly.rb
arunthampi-friendly-0.5.1 lib/friendly.rb