CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/anemone/storage.rb
Views: 11766
1
module Anemone
2
module Storage
3
4
def self.Hash(*args)
5
hash = Hash.new(*args)
6
# add close method for compatibility with Storage::Base
7
class << hash; def close; end; end
8
hash
9
end
10
11
def self.PStore(*args)
12
require 'anemone/storage/pstore'
13
self::PStore.new(*args)
14
end
15
16
def self.TokyoCabinet(file = 'anemone.tch')
17
require 'anemone/storage/tokyo_cabinet'
18
self::TokyoCabinet.new(file)
19
end
20
21
def self.MongoDB(mongo_db = nil, collection_name = 'pages')
22
require 'anemone/storage/mongodb'
23
mongo_db ||= Mongo::Connection.new.db('anemone')
24
raise "First argument must be an instance of Mongo::DB" unless mongo_db.is_a?(Mongo::DB)
25
self::MongoDB.new(mongo_db, collection_name)
26
end
27
28
def self.Redis(opts = {})
29
require 'anemone/storage/redis'
30
self::Redis.new(opts)
31
end
32
33
end
34
end
35
36