Sha256: abb9945c2633c3f6cb194003231a1e94333566074f3eff198806af113b607a30

Contents?: true

Size: 1.18 KB

Versions: 23

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

module Nanoc

  # Stores rule memories for objects that can be run through a rule (item
  # representations and layouts).
  #
  # @api private
  class RuleMemoryStore < ::Nanoc::Store

    # @option params [Nanoc::Site] site The site where this rule memory store
    #   belongs to
    def initialize(params={})
      super('tmp/rule_memory', 1)

      @site = params[:site] if params.has_key?(:site)

      @rule_memories = {}
    end

    # @param [Nanoc::ItemRep, Nanoc::Layout] obj The item representation or
    #   the layout to get the rule memory for
    #
    # @return [Array] The rule memory for the given object
    def [](obj)
      @rule_memories[obj.reference]
    end

    # @param [Nanoc::ItemRep, Nanoc::Layout] obj The item representation or
    #   the layout to set the rule memory for
    #
    # @param [Array] rule_memory The new rule memory to be stored
    #
    # @return [void]
    def []=(obj, rule_memory)
      @rule_memories[obj.reference] = rule_memory
    end

  protected

    # @see Nanoc::Store#data
    def data
      @rule_memories
    end

    # @see Nanoc::Store#data=
    def data=(new_data)
      @rule_memories = new_data
    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
nanoc-3.6.7 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.6 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.5 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.4 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.3 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.2 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.1 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.6.0 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.5.0 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.5.0b2 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.5.0b1 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.4.3 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.4.2 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.4.1 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.4.0 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.3.7 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.3.6 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.3.5 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.3.4 lib/nanoc/base/compilation/rule_memory_store.rb
nanoc-3.3.3 lib/nanoc/base/compilation/rule_memory_store.rb