def find_render_type call, in_view = false
rest = Sexp.new(:hash)
type = nil
value = nil
first_arg = call.first_arg
if call.second_arg.nil? and first_arg == Sexp.new(:lit, :update)
return :update, nil, Sexp.new(:arglist, *call.args[0..-2])
end
if string? first_arg or symbol? first_arg
if @current_template and @tracker.options[:rails3]
type = :partial
value = first_arg
else
type = :action
value = first_arg
end
elsif first_arg.is_a? Symbol or first_arg.is_a? String
type = :action
value = Sexp.new(:lit, first_arg.to_sym)
elsif first_arg.nil?
type = :default
elsif not hash? first_arg
type = :action
value = first_arg
end
types_in_hash = Set[:action, :file, :inline, :js, :json, :nothing, :partial, :template, :text, :update, :xml]
if in_view
types_in_hash << :layout
end
last_arg = call.last_arg
if hash? last_arg
hash_iterate(last_arg) do |key, val|
if symbol? key and types_in_hash.include? key.value
type = key.value
value = val
else
rest << key << val
end
end
end
type ||= :default
value ||= :default
if type == :inline and string? value and not hash_access(rest, :type)
value, rest = make_inline_render(value, rest)
end
return type, value, rest
end