From 7e1ab2ddb9a71e20e264e6dac2cce9f358025a6f Mon Sep 17 00:00:00 2001 From: Peter Suschlik Date: Mon, 16 Jul 2012 09:42:46 +0300 Subject: [PATCH] Use Enumerable#find{} instead of #select{}[0] --- lib/api_taster/route.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/api_taster/route.rb b/lib/api_taster/route.rb index f261d14..4b4b4a1 100644 --- a/lib/api_taster/route.rb +++ b/lib/api_taster/route.rb @@ -49,14 +49,14 @@ def grouped_routes end def find(id) - routes.select { |r| r[:id] == id.to_i }[0] + routes.find { |r| r[:id] == id.to_i } end def find_by_verb_and_path(verb, path) - routes.select do |r| + routes.find do |r| r[:path].to_s == path && r[:verb].to_s.downcase == verb.to_s.downcase - end[0] + end end def params_for(route)