lib/zip-code-info.rb in zip-code-info-0.1.0 vs lib/zip-code-info.rb in zip-code-info-0.1.1
- old
+ new
@@ -23,10 +23,10 @@
private
def assign_and_validate_code(code)
@code = code.to_s
- return @code.match /^[0-9]{5}$/i
+ return @code.match(/^[0-9]{5}$/i) && @data.has_key?(code_to_key)
end
# To look up information we only need the first three digits of the zip code
def code_to_key
@code[0..2]
\ No newline at end of file