lib/active_merchant/country.rb in activemerchant-1.86.0 vs lib/active_merchant/country.rb in activemerchant-1.87.0
- old
+ new
@@ -37,15 +37,15 @@
class Country
attr_reader :name
def initialize(options = {})
@name = options.delete(:name)
- @codes = options.collect{|k,v| CountryCode.new(v)}
+ @codes = options.collect { |k, v| CountryCode.new(v) }
end
def code(format)
- @codes.detect{|c| c.format == format}
+ @codes.detect { |c| c.format == format }
end
def ==(other)
if other.class == ActiveMerchant::Country
(@name == other.name)
@@ -322,12 +322,12 @@
case name.length
when 2, 3
upcase_name = name.upcase
country_code = CountryCode.new(name)
- country = COUNTRIES.detect{|c| c[country_code.format] == upcase_name }
+ country = COUNTRIES.detect { |c| c[country_code.format] == upcase_name }
else
- country = COUNTRIES.detect{|c| c[:name].upcase == name.upcase }
+ country = COUNTRIES.detect { |c| c[:name].casecmp(name).zero? }
end
raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
Country.new(country.dup)
end
end