Add this line to your application's Gemfile:
gem 'geohash_rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install geohash_rb
GeohashRb.decode("7nx4jpm")
# => -8.04542542, -34.92897034
GeohashRb.encode(-8.04542542, -34.92897034, 7)
# => 7nx4jpm
GeohashRb.neighbors("7nx4jpm")
# => ["7nx4jpt", "7nx4jpw", "7nx4jpq", "7nx4jpn", "7nx4jpj", "7nx4jph", "7nx4jpk", "7nx4jps"]
GeohashRb.parent_neighbors("7nx4jpm")
# => ["7nx4jn", "7nx4jq", "7nx4jr", "7nx4jp"]
Set the desired adjacent position parameter as (:left, :right, :top, :bottom)
GeohashRb.adjacent("7nx4jpm", :left)
# => "7nx4jpk"
Bug reports and pull requests are welcome on GitHub at https://github.com/mesainc/geohash-rb.