class Validiso::Countries
Public Class Methods
find_alpha2(val)
click to toggle source
# File lib/validiso/countries.rb, line 9 def find_alpha2(val) new.find(type: 'alpha2', value: val) end
find_alpha3(val)
click to toggle source
# File lib/validiso/countries.rb, line 12 def find_alpha3(val) new.find(type: 'alpha3', value: val) end
find_code(val)
click to toggle source
# File lib/validiso/countries.rb, line 6 def find_code(val) new.find(type: 'code', value: val) end
Public Instance Methods
find(type:, value:)
click to toggle source
# File lib/validiso/countries.rb, line 17 def find(type:, value:) value = value.to_s case type.to_s when 'code' Validiso::Data.codes[value] when 'alpha2' Validiso::Data.alpha2[value] when 'alpha3' Validiso::Data.alpha3[value] end end