lib/proxes/helpers/indices.rb in proxes-0.4.3 vs lib/proxes/helpers/indices.rb in proxes-0.4.4
- old
+ new
@@ -2,16 +2,16 @@
module ProxES
module Helpers
module Indices
def filter(asked, against)
- return against.map { |a| a.gsub(/\.\*/, '*') } if asked == ['*'] || asked == []
+ return against.map { |a| a.gsub(/\.\*/, '*') } if asked == ['*'] || asked == [] || asked.nil?
answer = []
against.each do |pattern|
answer.concat(asked.select { |idx| idx =~ /#{pattern}/ })
end
- answer
+ answer.count > 0 ? answer : against
end
end
end
end