diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string/output_safety.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 16 |
1 files changed, 16 insertions, 0 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 c930abc003..520aa4e67d 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -122,3 +122,19 @@ class String ActiveSupport::SafeBuffer.new(self) end end + +class Array + + alias_method :original_join, :join + + def join(sep=$,) + sep ||= "".html_safe + str = original_join(sep) + (sep.html_safe? && html_safe?) ? str.html_safe : str + end + + def html_safe? + self.detect {|e| !e.html_safe?}.nil? + end + +end |