aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-01-17 18:02:52 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-01-17 18:02:52 +0900
commit8e2feedd31df969746898f22576db4d605fc9d9c (patch)
tree98efa43519790e8cdde96516c0752bfe8bddfa27 /activesupport
parentdc01a40eacfea12140378854b662e79a63dd874a (diff)
downloadrails-8e2feedd31df969746898f22576db4d605fc9d9c.tar.gz
rails-8e2feedd31df969746898f22576db4d605fc9d9c.tar.bz2
rails-8e2feedd31df969746898f22576db4d605fc9d9c.zip
:golf: else + if = elsif
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 227c34b032..94ce3f6a61 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -152,18 +152,16 @@ module ActiveSupport #:nodoc:
def [](*args)
if args.size < 2
super
- else
- if html_safe?
- new_safe_buffer = super
-
- if new_safe_buffer
- new_safe_buffer.instance_variable_set :@html_safe, true
- end
+ elsif html_safe?
+ new_safe_buffer = super
- new_safe_buffer
- else
- to_str[*args]
+ if new_safe_buffer
+ new_safe_buffer.instance_variable_set :@html_safe, true
end
+
+ new_safe_buffer
+ else
+ to_str[*args]
end
end