Class: Nuva::Queries::LookupVaccineByCodeQuery
- Defined in:
- lib/nuva/queries.rb
Instance Method Summary collapse
- #call(code) ⇒ Object
-
#initialize(repositories) ⇒ LookupVaccineByCodeQuery
constructor
A new instance of LookupVaccineByCodeQuery.
Methods inherited from Query
Constructor Details
#initialize(repositories) ⇒ LookupVaccineByCodeQuery
Returns a new instance of LookupVaccineByCodeQuery.
143 144 145 |
# File 'lib/nuva/queries.rb', line 143 def initialize(repositories) @vaccines = repositories.vaccines end |
Instance Method Details
#call(code) ⇒ Object
147 148 149 150 151 |
# File 'lib/nuva/queries.rb', line 147 def call(code) @vaccines.all.find do |vac| "NUVA-#{vac.code}" == code || vac.codes.any? { |x| x.value == code } end end |