aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/layouts.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-07-25 00:31:35 +0200
committerXavier Noria <fxn@hashref.com>2016-07-25 00:31:35 +0200
commit7ebef567ce30d848dd8f9374fd70699fd91acb29 (patch)
tree9452737beec405626f309348b6d3c7fe4838ed91 /actionview/lib/action_view/layouts.rb
parent11b463d8cbacfe2cc1662f9e314440de71806ca9 (diff)
downloadrails-7ebef567ce30d848dd8f9374fd70699fd91acb29.tar.gz
rails-7ebef567ce30d848dd8f9374fd70699fd91acb29.tar.bz2
rails-7ebef567ce30d848dd8f9374fd70699fd91acb29.zip
systematic revision of =~ usage in AV
Where appropriate, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
Diffstat (limited to 'actionview/lib/action_view/layouts.rb')
-rw-r--r--actionview/lib/action_view/layouts.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb
index 8db1674187..8e956c47c6 100644
--- a/actionview/lib/action_view/layouts.rb
+++ b/actionview/lib/action_view/layouts.rb
@@ -1,5 +1,6 @@
-require "action_view/rendering"
-require "active_support/core_ext/module/remove_method"
+require 'action_view/rendering'
+require 'active_support/core_ext/module/remove_method'
+require 'active_support/core_ext/regexp'
module ActionView
# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
@@ -279,7 +280,7 @@ module ActionView
def _write_layout_method # :nodoc:
remove_possible_method(:_layout)
- prefixes = _implied_layout_name =~ /\blayouts/ ? [] : ["layouts"]
+ prefixes = /\blayouts/.match?(_implied_layout_name) ? [] : ["layouts"]
default_behavior = "lookup_context.find_all('#{_implied_layout_name}', #{prefixes.inspect}, false, [], { formats: formats }).first || super"
name_clause = if name
default_behavior