Module: Oxblood::Commands::Geo
- Included in:
- Oxblood::Commands
- Defined in:
- lib/oxblood/commands/geo.rb
Instance Method Summary collapse
-
#geoadd(key, *items) ⇒ Integer
Add one or more geospatial items in the geospatial index represented using a sorted set.
-
#geodist(key, member1, member2, unit = nil) ⇒ nil, String
Returns the distance between two members of a geospatial index.
-
#geohash(key, *members) ⇒ Array
Returns members of a geospatial index as standard geohash strings.
-
#geopos(key, *members) ⇒ Array
Returns longitude and latitude of members of a geospatial index.
-
#georadius(key, longitude, latitude, radius, unit, opts = {}) ⇒ Array, Integer
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point.
-
#georadiusbymember(key, member, radius, unit, opts = {}) ⇒ Array, Integer
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member.
Instance Method Details
#geoadd(key, *items) ⇒ Integer
Add one or more geospatial items in the geospatial index represented using a sorted set.
14 15 16 |
# File 'lib/oxblood/commands/geo.rb', line 14 def geoadd(key, *items) run(*items.unshift(:GEOADD, key)) end |
#geodist(key, member1, member2, unit = nil) ⇒ nil, String
Returns the distance between two members of a geospatial index.
56 57 58 59 60 61 62 |
# File 'lib/oxblood/commands/geo.rb', line 56 def geodist(key, member1, member2, unit = nil) if unit run(:GEODIST, key, member1, member2, unit) else run(:GEODIST, key, member1, member2) end end |
#geohash(key, *members) ⇒ Array
Returns members of a geospatial index as standard geohash strings.
26 27 28 |
# File 'lib/oxblood/commands/geo.rb', line 26 def geohash(key, *members) run(*members.unshift(:GEOHASH, key)) end |
#geopos(key, *members) ⇒ Array
Returns longitude and latitude of members of a geospatial index.
40 41 42 |
# File 'lib/oxblood/commands/geo.rb', line 40 def geopos(key, *members) run(*members.unshift(:GEOPOS, key)) end |
#georadius(key, longitude, latitude, radius, unit, opts = {}) ⇒ Array, Integer
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point.
98 99 100 101 102 |
# File 'lib/oxblood/commands/geo.rb', line 98 def georadius(key, longitude, latitude, radius, unit, opts = {}) args = [:GEORADIUS, key, longitude, latitude, radius, unit] add_georadius_opts!(args, opts) run(*args) end |
#georadiusbymember(key, member, radius, unit, opts = {}) ⇒ Array, Integer
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member.
137 138 139 140 141 |
# File 'lib/oxblood/commands/geo.rb', line 137 def georadiusbymember(key, member, radius, unit, opts = {}) args = [:GEORADIUSBYMEMBER, key, member, radius, unit] add_georadius_opts!(args, opts) run(*args) end |