Module: Redis::Commands::Geo
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/redis/commands/geo.rb |
Instance Method Summary
-
#geoadd(key, *member) ⇒ Integer
Adds the specified geospatial items (latitude, longitude, name) to the specified key.
-
#geodist(key, member1, member2, unit = 'm') ⇒ String?
Returns the distance between two members of a geospatial index.
-
#geohash(key, member) ⇒ Array<String, nil>
Returns geohash string representing position for specified members of the specified key.
-
#geopos(key, member) ⇒ Array<Array<String>, nil>
Returns longitude and latitude of members of a geospatial index.
-
#georadius(*args, **geoptions) ⇒ Array<String>
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point.
-
#georadiusbymember(*args, **geoptions) ⇒ Array<String>
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from an already existing member.
- #_geoarguments(*args, options: nil, sort: nil, count: nil) private
Instance Method Details
#_geoarguments(*args, options: nil, sort: nil, count: nil) (private)
[ GitHub ]# File 'lib/redis/commands/geo.rb', line 76
def _geoarguments(*args, options: nil, sort: nil, count: nil) args << sort if sort args << 'COUNT' << Integer(count) if count args << if args end
#geoadd(key, *member) ⇒ Integer
Adds the specified geospatial items (latitude, longitude, name) to the specified key
# File 'lib/redis/commands/geo.rb', line 11
def geoadd(key, *member) send_command([:geoadd, key, *member]) end
#geodist(key, member1, member2, unit = 'm') ⇒ String
?
Returns the distance between two members of a geospatial index
# File 'lib/redis/commands/geo.rb', line 70
def geodist(key, member1, member2, unit = 'm') send_command([:geodist, key, member1, member2, unit]) end
#geohash(key, member) ⇒ Array
<String
, nil
>
Returns geohash string representing position for specified members of the specified key.
# File 'lib/redis/commands/geo.rb', line 20
def geohash(key, member) send_command([:geohash, key, member]) end
#geopos(key, member) ⇒ Array
<Array
<String
>, nil
>
Returns longitude and latitude of members of a geospatial index
# File 'lib/redis/commands/geo.rb', line 60
def geopos(key, member) send_command([:geopos, key, member]) end
#georadius(*args, **geoptions) ⇒ Array
<String
>
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
# File 'lib/redis/commands/geo.rb', line 33
def georadius(*args, ** ) geoarguments = _geoarguments(*args, ** ) send_command([:georadius, *geoarguments]) end
#georadiusbymember(*args, **geoptions) ⇒ Array
<String
>
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from an already existing member
# File 'lib/redis/commands/geo.rb', line 48
def georadiusbymember(*args, ** ) geoarguments = _geoarguments(*args, ** ) send_command([:georadiusbymember, *geoarguments]) end