From b3bfa361c503e107aff4dee5edf79bd7fd3d3725 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 28 Oct 2014 16:17:33 -0700 Subject: let's warn with heredocs The current style for warning messages without newlines uses concatenation of string literals with manual trailing spaces where needed. Heredocs have better readability, and with `squish` we can still produce a single line. This is a similar use case to the one that motivated defining `strip_heredoc`, heredocs are super clean. --- actionpack/lib/action_dispatch/http/response.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 99d46af953..2918a98796 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/module/attribute_accessors' +require 'active_support/core_ext/string/filters' require 'active_support/deprecation' require 'action_dispatch/http/filter_redirect' require 'monitor' @@ -288,7 +289,12 @@ module ActionDispatch # :nodoc: # as arrays work, and "flattening" responses, cascading to the rack body! # Not sensible behavior. def to_ary - ActiveSupport::Deprecation.warn 'ActionDispatch::Response#to_ary no longer performs implicit conversion to an Array. Please use response.to_a instead, or a splat like `status, headers, body = *response`' + ActiveSupport::Deprecation.warn(<<-MSG.squish) + 'ActionDispatch::Response#to_ary no longer performs implicit conversion + to an Array. Please use response.to_a instead, or a splat like `status, + headers, body = *response` + MSG + to_a end -- cgit v1.2.3