Try the exact same syntax for the block, but use "find"


Pretty much the same thing, but less confusion for future readers.

On Mon, Jan 27, 2014 at 12:58 PM, noahpatterson <notifications@github.com>
wrote:

>>      CalculatesRoute.calculate(cities)
>>    end
>> +
>> +  def calculate_total_miles(route)
>> +    route.map {|leg| leg.fetch(:distance)}.reduce(:+)
>> +  end
>> +
>> +  def calculate_traveling_time(total_miles, speed = 55)
>> +    total_miles/speed
>> +  end
>> +
>> +  private
>> +
>> +  def find_starting_point(starting_point_name)
>> +    @cities.bsearch {|place| place.name.downcase == starting_point_name.downcase }
> This was me looking at docs trying to find a way to search an array, quickly. Is there a better way?
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/RubyoffRails/Episode7/pull/11/files#r9200786