def distance
      return nil unless @locations.size > 1
      locations.each_cons(2).reduce(0) do |acc, (loc1, loc2)|
        acc + loc1.distance_to(loc2)
      end
    end
def distance
      return nil unless @locations.size > 1
      locations.each_cons(2).reduce(0) do |acc, (loc1, loc2)|
        acc + loc1.distance_to(loc2)
      end
    end
def distance return nil unless @locations . size > 1 locations . each_cons ( 2 ) . reduce ( 0 ) do | acc , ( loc1 , loc2 ) | acc + loc1 . distance_to ( loc2 ) end end
Give the distance in meters between ordered
 location points using the 'Haversine' formula
Give the distance in meters between ordered location points using the Haversine formula