Sha256: 5c6bc58169283f010fdc26b21b1771ca94021405627c0845a73a7aadb1dd5c17

Contents?: true

Size: 1.04 KB

Versions: 23

Compression:

Stored size: 1.04 KB

Contents

module Nanoc::Int
  # Stores rule memories for objects that can be run through a rule (item
  # representations and layouts).
  #
  # @api private
  class RuleMemoryStore < ::Nanoc::Int::Store
    def initialize
      super('tmp/rule_memory', 1)

      @rule_memories = {}
    end

    # @param [Nanoc::Int::ItemRep, Nanoc::Int::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::Int::ItemRep, Nanoc::Int::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::Int::Store#data
    def data
      @rule_memories
    end

    # @see Nanoc::Int::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-4.5.4 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.3.4 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.3.3 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.3.2 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.3.1 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.3.0 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.4 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.3 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.2 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.1 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.0 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.6 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.2.0b1 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.5 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.4 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.3 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.2 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.1 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.0 lib/nanoc/base/repos/rule_memory_store.rb
nanoc-4.1.0rc2 lib/nanoc/base/repos/rule_memory_store.rb