From a9dc45459abcd9437085f4dd0aa3c9d0e64e062f Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 8 Aug 2016 01:05:28 +0200 Subject: code gardening: removes redundant selfs A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required. --- actionpack/lib/action_controller/metal/head.rb | 2 +- actionpack/lib/action_controller/metal/instrumentation.rb | 2 +- actionpack/lib/action_controller/metal/rendering.rb | 2 +- actionpack/lib/action_controller/metal/strong_parameters.rb | 2 +- actionpack/lib/action_controller/test_case.rb | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index 97306b5265..86b5eb20d7 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -41,7 +41,7 @@ module ActionController self.response_body = "" - if include_content?(self.response_code) + if include_content?(response_code) self.content_type = content_type || (Mime[formats.first] if formats) self.response.charset = false end diff --git a/actionpack/lib/action_controller/metal/instrumentation.rb b/actionpack/lib/action_controller/metal/instrumentation.rb index 6a8129e88b..2ede96c667 100644 --- a/actionpack/lib/action_controller/metal/instrumentation.rb +++ b/actionpack/lib/action_controller/metal/instrumentation.rb @@ -17,7 +17,7 @@ module ActionController def process_action(*args) raw_payload = { controller: self.class.name, - action: self.action_name, + action: action_name, params: request.filtered_parameters, headers: request.headers, format: request.format.ref, diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index 41b166b346..ac17d61b96 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -32,7 +32,7 @@ module ActionController # Check for double render errors and set the content_type after rendering. def render(*args) #:nodoc: - raise ::AbstractController::DoubleRenderError if self.response_body + raise ::AbstractController::DoubleRenderError if response_body super end diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 32ab8ca2ac..7f5144bc49 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -719,7 +719,7 @@ module ActionController end def unpermitted_keys(params) - self.keys - params.keys - self.always_permitted_parameters + keys - params.keys - always_permitted_parameters end # diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 19bd18e110..ccedecd6f4 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -83,7 +83,7 @@ module ActionController end if get? - if self.query_string.blank? + if query_string.blank? self.query_string = non_path_parameters.to_query end else @@ -492,8 +492,8 @@ module ActionController @html_document = nil - self.cookies.update @request.cookies - self.cookies.update_cookies_from_jar + cookies.update(@request.cookies) + cookies.update_cookies_from_jar @request.set_header "HTTP_COOKIE", cookies.to_header @request.delete_header "action_dispatch.cookies" @@ -538,7 +538,7 @@ module ActionController if @request.have_cookie_jar? unless @request.cookie_jar.committed? @request.cookie_jar.write(@response) - self.cookies.update(@request.cookie_jar.instance_variable_get(:@cookies)) + cookies.update(@request.cookie_jar.instance_variable_get(:@cookies)) end end @response.prepare! -- cgit v1.2.3