fix: check if country is available

This commit is contained in:
f
2023-04-22 21:05:32 -03:00
parent 3e25cf532a
commit 8be1dbca5b

View File

@ -9,13 +9,13 @@ class SWD
# Return the marginal intensity for a country when provided an ISO
# code
def self.marginal_by_iso(iso : String) : Float64?
MARGINAL_INTENSITY_BY_ISO_CODE[iso]
MARGINAL_INTENSITY_BY_ISO_CODE[iso] if MARGINAL_INTENSITY_BY_ISO_CODE.has_key? iso
end
# Return the average intensity for a country when provided an ISO
# code
def self.average_by_iso(iso : String) : Float64?
AVERAGE_INTENSITY_BY_ISO_CODE[iso]
AVERAGE_INTENSITY_BY_ISO_CODE[iso] if AVERAGE_INTENSITY_BY_ISO_CODE.has_key? iso
end
def self.by_iso(iso : String, type : Symbol = :marginal) : Float64?