Sha256: 60fd52e44b5c00558c8607504f56c1efcb736859e76bb7f737e27c00ffb349ef

Contents?: true

Size: 910 Bytes

Versions: 6

Compression:

Stored size: 910 Bytes

Contents

module Spontaneous::Output::Store
  class Revision
    attr_reader :revision, :store


    def initialize(revision, store)
      @revision, @store = revision, store
    end

    def transaction
      Transaction.new(@revision, @store)
    end

    # Tests for the existance of a static template
    # This provides a way to short-cut the render step as
    # if this returns a non-nil result then we can reply
    # directly to the request with this template & skip the
    # render step
    def static_template(output)
      key = @store.output_key(output)
      @store.load_protected(@revision, key) || @store.load_static(@revision, key)
    end

    # Return a template for the given output
    def dynamic_template(output, request = nil)
      key = @store.output_key(output, true)
      @store.load_dynamic(@revision, key)
    end

    def delete
      @store.delete_revision(@revision)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/output/store/revision.rb
spontaneous-0.2.0.beta9 lib/spontaneous/output/store/revision.rb
spontaneous-0.2.0.beta8 lib/spontaneous/output/store/revision.rb
spontaneous-0.2.0.beta7 lib/spontaneous/output/store/revision.rb
spontaneous-0.2.0.beta6 lib/spontaneous/output/store/revision.rb
spontaneous-0.2.0.beta5 lib/spontaneous/output/store/revision.rb