Module: JsonSpec::Memory

Included in:
JsonSpec
Defined in:
lib/json_spec/memory.rb

Instance Method Summary collapse

Instance Method Details

#forgetObject



15
16
17
# File 'lib/json_spec/memory.rb', line 15

def forget
  memory.clear
end

#memorize(key, value) ⇒ Object



7
8
9
# File 'lib/json_spec/memory.rb', line 7

def memorize(key, value)
  memory[key.to_sym] = value
end

#memoryObject



3
4
5
# File 'lib/json_spec/memory.rb', line 3

def memory
  @memory ||= {}
end

#remember(json) ⇒ Object



11
12
13
# File 'lib/json_spec/memory.rb', line 11

def remember(json)
  memory.empty? ? json : json % memory
end