Module: ZipCodes

Defined in:
lib/zip-codes.rb

Constant Summary collapse

VERSION =
'0.3.5'

Class Method Summary collapse

Class Method Details

.dbObject



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

def db
  @db ||= begin
    path = File.join(__dir__, 'data', 'US.yml')
    ::YAML.safe_load_file(path, permitted_classes: [Symbol])
  end
end

.identify(code) ⇒ Object



9
10
11
# File 'lib/zip-codes.rb', line 9

def identify(code)
  db[code]
end

.loadObject



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

def load
  db
end