class Nanoc::Core::ActionSequenceStore

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

@api private

Public Class Methods

new(config:) click to toggle source
Calls superclass method Nanoc::Core::Store::new
# File lib/nanoc/core/action_sequence_store.rb, line 13
def initialize(config:)
  super(Nanoc::Core::Store.tmp_path_for(config: config, store_name: 'rule_memory'), 1)

  @action_sequences = {}
end

Public Instance Methods

[](obj) click to toggle source

@param [Nanoc::Core::ItemRep, Nanoc::Core::Layout] obj The item representation or

the layout to get the action sequence for

@return [Array] The action sequence for the given object

# File lib/nanoc/core/action_sequence_store.rb, line 23
def [](obj)
  @action_sequences[obj.reference]
end
[]=(obj, action_sequence) click to toggle source

@param [Nanoc::Core::ItemRep, Nanoc::Core::Layout] obj The item representation or

the layout to set the action sequence for

@param [Array] action_sequence The new action sequence to be stored

@return [void]

# File lib/nanoc/core/action_sequence_store.rb, line 33
def []=(obj, action_sequence)
  @action_sequences[obj.reference] = action_sequence
end

Protected Instance Methods

data() click to toggle source

@see Nanoc::Core::Store#data

# File lib/nanoc/core/action_sequence_store.rb, line 40
def data
  @action_sequences
end
data=(new_data) click to toggle source

@see Nanoc::Core::Store#data=

# File lib/nanoc/core/action_sequence_store.rb, line 45
def data=(new_data)
  @action_sequences = new_data
end