Class: Nuva::Queries::LookupVaccineByCode

Inherits:
Object
  • Object
show all
Defined in:
lib/nuva/queries.rb

Overview

lookupVaccineByCode(code: string): Vaccine | undefined; lookupEquivalentVaccines(vaccine: Vaccine): Vaccine[]; lookupSpecializedVaccines(vaccine: Vaccine): Vaccine[]; lookupGeneralizedVaccines(vaccine: Vaccine): Vaccine[]; allNomenclatures(): string[]; allCodeByNomenclature():

[nomenclature: string]: Code[];

;

Instance Method Summary collapse

Constructor Details

#initialize(repositories) ⇒ LookupVaccineByCode

Returns a new instance of LookupVaccineByCode.



129
130
131
# File 'lib/nuva/queries.rb', line 129

def initialize(repositories)
  @vaccines = repositories.vaccines
end

Instance Method Details

#call(code) ⇒ Object



133
134
135
136
137
# File 'lib/nuva/queries.rb', line 133

def call(code)
  @vaccines.all.find do |vac|
    "NUVA-#{vac.code}" == code || vac.codes.any? do |x| x.value == code end
  end
end