Sha256: 098aaad568a67532d02799b60210730977dd28b2b1e66302d30146131e268e65

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

module Anemone
  module Storage

    def self.Hash(*args)
      hash = Hash.new(*args)
      # add close method for compatibility with Storage::Base
      class << hash; def close; end; end
      hash
    end

    def self.PStore(*args)
      require 'anemone/storage/pstore'
      self::PStore.new(*args)
    end

    def self.TokyoCabinet(file = 'anemone.tch')
      require 'anemone/storage/tokyo_cabinet'
      self::TokyoCabinet.new(file)
    end

    def self.KyotoCabinet(file = 'anemone.kch')
      require 'anemone/storage/kyoto_cabinet'
      self::KyotoCabinet.new(file)
    end

    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

    def self.Redis(opts = {})
      require 'anemone/storage/redis'
      self::Redis.new(opts)
    end
    
    def self.SQLite3(file = 'anemone.db')
      require 'anemone/storage/sqlite3'
      self::SQLite3.new(file)
    end

  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
sutch-anemone-0.7.2.2 lib/anemone/storage.rb
sutch-anemone-0.7.2.1 lib/anemone/storage.rb
sutch-anemone-0.7.2 lib/anemone/storage.rb
rodneyc-anemone-0.7.1.3 lib/anemone/storage.rb
rodneyc-anemone-0.7.1.2 lib/anemone/storage.rb
rodneyc-anemone-0.7.1.1 lib/anemone/storage.rb
anemone-0.7.2 lib/anemone/storage.rb
anemone-0.7.1 lib/anemone/storage.rb