Module: ZipCodes

Defined in:
lib/zip-codes.rb

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.dbObject



11
12
13
14
15
16
17
# File 'lib/zip-codes.rb', line 11

def db
  @db ||= begin
    this_file = File.expand_path(File.dirname(__FILE__))
    us_data = File.join(this_file, "data", "US.yml")
    YAML.load(File.open(us_data))
  end
end

.identify(code) ⇒ Object



7
8
9
# File 'lib/zip-codes.rb', line 7

def identify code
  db[code]
end

.loadObject



19
20
21
# File 'lib/zip-codes.rb', line 19

def load
  db
end