Class: Soup::Backends::Memory

Inherits:
Base
  • Object
show all
Defined in:
lib/soup/backends/memory.rb

Instance Method Summary collapse

Methods inherited from Base

#find

Instance Method Details

#all_snipsObject



12
13
14
# File 'lib/soup/backends/memory.rb', line 12

def all_snips
  @snips.values
end

#destroy(name) ⇒ Object



20
21
22
# File 'lib/soup/backends/memory.rb', line 20

def destroy(name)
  @snips[name] = nil
end

#load_snip(name) ⇒ Object



16
17
18
# File 'lib/soup/backends/memory.rb', line 16

def load_snip(name)
  @snips[name]
end

#prepareObject



4
5
6
# File 'lib/soup/backends/memory.rb', line 4

def prepare
  @snips = {}
end

#save_snip(attributes) ⇒ Object



8
9
10
# File 'lib/soup/backends/memory.rb', line 8

def save_snip(attributes)
  @snips[attributes[:name]] = Snip.new(attributes, self)
end