diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-07-25 05:21:16 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-25 16:33:04 +0200 |
commit | b1cfcedc8f6dde3b0855fc8fd564e72e730ba5cf (patch) | |
tree | 459d52879fe866fe5321a730919a2ac6b7c55805 /actionpack | |
parent | 8d5b792e7dadf8b2f64b75b6fee51d15fde70699 (diff) | |
download | rails-b1cfcedc8f6dde3b0855fc8fd564e72e730ba5cf.tar.gz rails-b1cfcedc8f6dde3b0855fc8fd564e72e730ba5cf.tar.bz2 rails-b1cfcedc8f6dde3b0855fc8fd564e72e730ba5cf.zip |
Change returning with tap
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack')
5 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 650eb16ac0..e306697f4b 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -365,7 +365,7 @@ module ActionController def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil) @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' @request.env['HTTP_ACCEPT'] ||= [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ') - returning __send__(request_method, action, parameters, session, flash) do + __send__(request_method, action, parameters, session, flash).tap do @request.env.delete 'HTTP_X_REQUESTED_WITH' @request.env.delete 'HTTP_ACCEPT' end diff --git a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb index b3146a1c60..4904f0633d 100644 --- a/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb +++ b/actionpack/lib/action_dispatch/routing/deprecated_mapper.rb @@ -500,7 +500,7 @@ module ActionDispatch end def add_conditions_for(conditions, method) - returning({:conditions => conditions.dup}) do |options| + {:conditions => conditions.dup}.tap do |options| options[:conditions][:method] = method unless method == :any end end diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 64eb6d8de7..8e58adaf59 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -319,7 +319,7 @@ module ActionDispatch reset! unless @integration_session # reset the html_document variable, but only for new get/post calls @html_document = nil unless %w(cookies assigns).include?(method) - returning @integration_session.__send__(method, *args) do + @integration_session.__send__(method, *args).tap do copy_session_variables! end end @@ -362,7 +362,7 @@ module ActionDispatch def method_missing(sym, *args, &block) reset! unless @integration_session if @integration_session.respond_to?(sym) - returning @integration_session.__send__(sym, *args, &block) do + @integration_session.__send__(sym, *args, &block).tap do copy_session_variables! end else diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 4c1b751160..9dac2d4538 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -1,6 +1,5 @@ require 'cgi' require 'action_view/helpers/tag_helper' -require 'active_support/core_ext/object/returning' require 'active_support/core_ext/object/blank' module ActionView @@ -527,7 +526,7 @@ module ActionView private def html_options_for_form(url_for_options, options, *parameters_for_url) - returning options.stringify_keys do |html_options| + options.stringify_keys.tap do |html_options| html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart") # The following URL is unescaped, this is just a hash of options, and it is the # responsability of the caller to escape all the values. diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 9f3d68a639..f7c42c7f22 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -114,7 +114,7 @@ class CaptureHelperTest < ActionView::TestCase end def view_with_controller - returning(TestController.new.view_context) do |view| + TestController.new.view_context.tap do |view| view.output_buffer = ActionView::OutputBuffer.new end end |