module IndianPincodes
@return Details like state name, city name, post office based on pincode.
Constants
- VERSION
Public Class Methods
db()
click to toggle source
Find details from yaml file
# File lib/indian_pincodes.rb, line 11 def db @db ||= begin this_file = File.expand_path(File.dirname(__FILE__)) india_data = File.join(this_file, 'data/INDIA.yml') YAML.load(File.open(india_data)) end end
load()
click to toggle source
Preload yaml file
# File lib/indian_pincodes.rb, line 19 def load db end
search(code)
click to toggle source
Search details from pincode
# File lib/indian_pincodes.rb, line 7 def search(code) db[code] end