On 10/30/07, Josselin <josselin / wanadoo.fr> wrote:
> I have a group of lines  (used in Googlemaps display)  based on 2 arrays :
>
> zl = 9 if farthest_proposition.distance_to(origin) < = 25.0
> zl = 10 if farthest_proposition.distance_to(origin) <= 15.0
> zl = 11 if farthest_proposition.distance_to(origin) <= 10.0
> zl = 12 if farthest_proposition.distance_to(origin) <= 5.0
> zl = 13 if farthest_proposition.distance_to(origin) < =2.0
> zl = 14 if farthest_proposition.distance_to(origin) <= 1.0
>
> how could I replace it the dryest way possible ?
>
> zl = [9, 10, 11, 12, 13, 14]
> distance = [1.0, 2.0, 5.0, 10.0, 15.0, 25.0]

s = farthest_proposition.distance_to(origin)
zl = distance.zip(zl.reverse) {|d, z| break [z,d] if s <= d}

martin