Module: TZip::ClassMethods

Defined in:
lib/tzip/base.rb

Instance Method Summary collapse

Instance Method Details

#find_by_zipcode(zipcode) ⇒ Object



3
4
5
6
7
8
# File 'lib/tzip/base.rb', line 3

def find_by_zipcode(zipcode)
  [5,4,3,2,1].each do |i|
    return MAPPING[zipcode.to_s[0,i]] if MAPPING.has_key?(zipcode.to_s[0,i])
  end      
  return nil
end