Class: Soup::Backends::Base

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

Direct Known Subclasses

FileBackend, Memory, MultiSoup, ReadOnly, YAMLBackend

Instance Method Summary collapse

Instance Method Details

#find(conditions) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/soup/backends/base.rb', line 4

def find(conditions)
  if conditions.keys == [:name]
    load_snip(conditions[:name])
  else
    all_snips.select do |s|
      conditions.inject(true) do |matches, (key, value)|
        matches && (s.__send__(key) == value)
      end
    end
  end
end