Class: LLMSpecs::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/llm_specs/collection.rb

Instance Method Summary collapse

Instance Method Details

#find(id) ⇒ Object



4
5
6
# File 'lib/llm_specs/collection.rb', line 4

def find(id)
  super() { it.id == id } or raise ModelNotFound.new(id)
end

#where(**criteria) ⇒ Object



8
9
10
11
12
# File 'lib/llm_specs/collection.rb', line 8

def where(**criteria)
  select do |model| 
    criteria.all? { |k,v| model.send(k) == v }
  end
end