aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-08-01 16:41:26 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-08-01 17:58:00 +0900
commitaf2129b4c74732c88ffce76e5c55c805cb9431f6 (patch)
treec74d8c85f81ea6b3a5e4209be247c9d83666bd4d /actionpack/lib/action_dispatch
parentdbf3e4882f9da95e34ed9086f182cf424aaac224 (diff)
downloadrails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.gz
rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.bz2
rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.zip
Use `try` only when we're unsure if the receiver would respond_to the method
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/feature_policy.rb2
-rw-r--r--actionpack/lib/action_dispatch/system_testing/browser.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/feature_policy.rb b/actionpack/lib/action_dispatch/http/feature_policy.rb
index 78e982918d..c09690f9fc 100644
--- a/actionpack/lib/action_dispatch/http/feature_policy.rb
+++ b/actionpack/lib/action_dispatch/http/feature_policy.rb
@@ -42,7 +42,7 @@ module ActionDispatch #:nodoc:
end
def policy_empty?(policy)
- policy.try(:directives) && policy.directives.empty?
+ policy&.directives&.empty?
end
end
diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb
index e861e52f09..91f332be13 100644
--- a/actionpack/lib/action_dispatch/system_testing/browser.rb
+++ b/actionpack/lib/action_dispatch/system_testing/browser.rb
@@ -47,14 +47,14 @@ module ActionDispatch
case type
when :chrome
if ::Selenium::WebDriver::Service.respond_to? :driver_path=
- ::Selenium::WebDriver::Chrome::Service.driver_path.try(:call)
+ ::Selenium::WebDriver::Chrome::Service.driver_path&.call
else
# Selenium <= v3.141.0
::Selenium::WebDriver::Chrome.driver_path
end
when :firefox
if ::Selenium::WebDriver::Service.respond_to? :driver_path=
- ::Selenium::WebDriver::Firefox::Service.driver_path.try(:call)
+ ::Selenium::WebDriver::Firefox::Service.driver_path&.call
else
# Selenium <= v3.141.0
::Selenium::WebDriver::Firefox.driver_path