Module: Anemone::Storage
- Defined in:
- lib/anemone/storage.rb,
lib/anemone/storage/base.rb,
lib/anemone/storage/redis.rb,
lib/anemone/storage/pstore.rb,
lib/anemone/storage/mongodb.rb,
lib/anemone/storage/sqlite3.rb,
lib/anemone/storage/exceptions.rb,
lib/anemone/storage/kyoto_cabinet.rb,
lib/anemone/storage/tokyo_cabinet.rb
Defined Under Namespace
Classes: Base, CloseError, ConnectionError, GenericError, InsertionError, KyotoCabinet, MongoDB, PStore, Redis, RetrievalError, SQLite3, TokyoCabinet
Class Method Summary
collapse
Class Method Details
.Hash(*args) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/anemone/storage.rb', line 4
def self.Hash(*args)
hash = Hash.new(*args)
class << hash; def close; end; end
hash
end
|
.KyotoCabinet(file = 'anemone.kch') ⇒ Object
21
22
23
24
|
# File 'lib/anemone/storage.rb', line 21
def self.KyotoCabinet(file = 'anemone.kch')
require 'anemone/storage/kyoto_cabinet'
self::KyotoCabinet.new(file)
end
|
.MongoDB(mongo_db = nil, collection_name = 'pages') ⇒ Object
26
27
28
29
30
31
|
# File 'lib/anemone/storage.rb', line 26
def self.MongoDB(mongo_db = nil, collection_name = 'pages')
require 'anemone/storage/mongodb'
mongo_db ||= Mongo::Connection.new.db('anemone')
raise "First argument must be an instance of Mongo::DB" unless mongo_db.is_a?(Mongo::DB)
self::MongoDB.new(mongo_db, collection_name)
end
|
.PStore(*args) ⇒ Object
11
12
13
14
|
# File 'lib/anemone/storage.rb', line 11
def self.PStore(*args)
require 'anemone/storage/pstore'
self::PStore.new(*args)
end
|
.Redis(opts = {}) ⇒ Object
33
34
35
36
|
# File 'lib/anemone/storage.rb', line 33
def self.Redis(opts = {})
require 'anemone/storage/redis'
self::Redis.new(opts)
end
|
.SQLite3(file = 'anemone.db') ⇒ Object
38
39
40
41
|
# File 'lib/anemone/storage.rb', line 38
def self.SQLite3(file = 'anemone.db')
require 'anemone/storage/sqlite3'
self::SQLite3.new(file)
end
|
.TokyoCabinet(file = 'anemone.tch') ⇒ Object
16
17
18
19
|
# File 'lib/anemone/storage.rb', line 16
def self.TokyoCabinet(file = 'anemone.tch')
require 'anemone/storage/tokyo_cabinet'
self::TokyoCabinet.new(file)
end
|