Class: Nanoc3::RuleMemoryStore Private

Inherits:
Store
  • Object
show all
Defined in:
lib/nanoc3/base/compilation/rule_memory_store.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Stores rule memories for objects that can be run through a rule (item representations and layouts).

Instance Attribute Summary

Attributes inherited from Store

#filename, #version

Instance Method Summary collapse

Methods inherited from Store

#load, #no_data_found, #store, #unload, #version_mismatch_detected

Constructor Details

#initialize(params = {}) ⇒ RuleMemoryStore

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RuleMemoryStore.

Parameters:

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • site (Nanoc3::Site)

    The site where this rule memory store belongs to



13
14
15
16
17
18
19
# File 'lib/nanoc3/base/compilation/rule_memory_store.rb', line 13

def initialize(params={})
  super('tmp/rule_memory', 1)

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

  @rule_memories = {}
end

Instance Method Details

#[](obj) ⇒ Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The rule memory for the given object.

Parameters:

Returns:

  • (Array)

    The rule memory for the given object



25
26
27
# File 'lib/nanoc3/base/compilation/rule_memory_store.rb', line 25

def [](obj)
  @rule_memories[obj.reference]
end

#[]=(obj, rule_memory) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



35
36
37
# File 'lib/nanoc3/base/compilation/rule_memory_store.rb', line 35

def []=(obj, rule_memory)
  @rule_memories[obj.reference] = rule_memory
end