1
if @near.nil?
  loc, @near, found = get_user_geolocation
else
  loc = GeoKit::Geocoders::GoogleGeocoder.geocode(@near)
  found = loc.success
  @near = loc.full_address
end

在第一个 if 部分,发生了什么?我可能不擅长语法,但这让我很好奇。提前致谢。

4

2 回答 2

5

参见多重赋值

> a,b,c = [10,20,30] # or a,b,c = 10,20,30
> a => 10 
> b => 20 
> c => 30 
于 2013-01-24T11:10:43.733 回答
1

get_user_geolocation方法返回三个值loc@nearfound

于 2013-01-24T11:02:57.990 回答