[UTIL] Set up params correctly in the Ruby template

When no params are specified in the spec, set `params` to empty Hash.
This commit is contained in:
Karel Minarik 2013-06-20 15:13:58 +02:00
parent e541dc14a3
commit c1d2ada564

View File

@ -47,6 +47,8 @@ module Elasticsearch
<%= ' '*@namespace_depth %> end
<%= ' '*@namespace_depth %> # Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
<%= ' '*@namespace_depth %> params = Hash[params] unless params.is_a?(Hash)
<%- else -%>
<%= ' '*@namespace_depth %> params = {}
<%- end -%>
<%= ' '*@namespace_depth %> body = <%= @spec['body'].nil? ? 'nil' : 'arguments[:body]' %>
<%# Perform request %>