From c12b1f397562e31e105d976c4d89332e66417283 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Fri, 7 Dec 2012 15:57:53 -0500 Subject: [PATCH] Fix broken Query#blank? method. --- lib/geocoder/query.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/geocoder/query.rb b/lib/geocoder/query.rb index ed438610..d0f4469e 100644 --- a/lib/geocoder/query.rb +++ b/lib/geocoder/query.rb @@ -42,8 +42,9 @@ module Geocoder # no URL parameters are specified. # def blank? - !!text.to_s.match(/^\s*$/) and ( - !options[:params].is_a?(Hash) or options[:params].keys.size == 0 + !params_given? and ( + (text.is_a?(Array) and text.compact.size < 2) or + text.to_s.match(/^\s*$/) ) end @@ -88,5 +89,11 @@ module Geocoder def reverse_geocode? coordinates? end + + private # ---------------------------------------------------------------- + + def params_given? + !!(options[:params].is_a?(Hash) and options[:params].keys.size > 0) + end end end -- GitLab