lib/worldwide/region.rb in worldwide-0.4.1 vs lib/worldwide/region.rb in worldwide-0.5.0
- old
+ new
@@ -270,9 +270,20 @@
return self if country?
parent_country
end
+ def associated_continent
+ return self if continent?
+
+ parents.each do |parent|
+ candidate = parent.associated_continent
+ return candidate unless candidate.nil?
+ end
+
+ nil
+ end
+
# The value with which to autofill the zip, if this region has zip autofill active;
# otherwise, nil.
def autofill_zip
zip_example if @zip_autofill_enabled
end