Sha256: 61b95d4b0dc9c04ff1638756f23a3a142ac9185ef9d9c0738cdf138addc84306

Contents?: true

Size: 787 Bytes

Versions: 3

Compression:

Stored size: 787 Bytes

Contents

require_relative 'content_caching/version'
require_relative 'content_caching/configuration'
require_relative 'content_caching/wrapper'
require_relative 'content_caching/adapters/base'

begin
  require 'pry'
rescue LoadError
end

require 'forwardable'

module ContentCaching
  class << self
    attr_writer :configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.reset
    @configuration = Configuration.new
  end

  def self.configure
    yield(configuration)
  end

  class Document
    extend Forwardable

    def_delegators :adapter, :store, :url, :delete
    attr_accessor :adapter

    def initialize wrapper
      self.adapter = ContentCaching::Adapter::Base.create(ContentCaching.configuration.adapter, wrapper)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
content_caching-0.2.0 lib/content_caching.rb
content_caching-0.1.1 lib/content_caching.rb
content_caching-0.1.0 lib/content_caching.rb