Class: Nuva::Queries::LookupEquivalentVaccines
- Inherits:
-
Object
- Object
- Nuva::Queries::LookupEquivalentVaccines
- Defined in:
- lib/nuva/queries.rb
Instance Method Summary collapse
- #call(vaccine) ⇒ Object
-
#initialize(repositories) ⇒ LookupEquivalentVaccines
constructor
A new instance of LookupEquivalentVaccines.
Constructor Details
#initialize(repositories) ⇒ LookupEquivalentVaccines
Returns a new instance of LookupEquivalentVaccines.
141 142 143 |
# File 'lib/nuva/queries.rb', line 141 def initialize(repositories) @vaccines = repositories.vaccines end |
Instance Method Details
#call(vaccine) ⇒ Object
145 146 147 148 149 150 |
# File 'lib/nuva/queries.rb', line 145 def call(vaccine) vids = vaccine.valence_ids.sort @vaccines.all.filter do |v| v.valence_ids.length == vids.length && v.id != vaccine.id && vids == v.valence_ids.sort end end |