class CiteProc::Ruby::Renderer::History
Attributes
Public Class Methods
Source
# File lib/citeproc/ruby/renderer/history.rb, line 8 def initialize(state, maxsize = 10) @state, @maxsize, = state, maxsize @state.add_observer(self) @memory = Hash.new do |hash, key| hash[key] = [] end end
Public Instance Methods
Source
# File lib/citeproc/ruby/renderer/history.rb, line 33 def bibliography memory['bibliography'] end
Source
# File lib/citeproc/ruby/renderer/history.rb, line 29 def citation memory['citation'] end
Source
# File lib/citeproc/ruby/renderer/history.rb, line 37 def discard memory.clear self end
Source
# File lib/citeproc/ruby/renderer/history.rb, line 25 def recall(mode) memory[mode][-1] end
Source
# File lib/citeproc/ruby/renderer/history.rb, line 17 def update(action, mode, memories = {}) history = memory[mode] history << memories ensure history.shift if history.length > maxsize end