From 1814298d7590988d354955efdb0bc495b359293b Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Thu, 10 Feb 2011 16:45:39 +0100 Subject: Removed Array#safe_join in AS core_ext and moved it to a view helper with the same same. This also changes how safe_join works, if items or the separator are not html_safe they are html_escape'd, a html_safe string is always returned. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- .../core_ext/string/output_safety.rb | 31 ---------------------- 1 file changed, 31 deletions(-) (limited to 'activesupport/lib/active_support/core_ext') 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 0c8fc20ea5..c930abc003 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -122,34 +122,3 @@ class String ActiveSupport::SafeBuffer.new(self) end end - -class Array - # If the separator and all the items in the array are html safe - # then an html safe string is returned using Array#join, - # otherwise the result of Array#join is returned without - # marking it as html safe. - # - # ["Mr", "Bojangles"].join.html_safe? - # # => false - # - # ["Mr".html_safe, "Bojangles".html_safe].join.html_safe? - # # => true - # - def safe_join(sep=$,) - sep ||= "".html_safe - str = join(sep) - (sep.html_safe? && html_safe?) ? str.html_safe : str - end - - # Returns +true+ if all items in the array are html safe. - # - # [""].html_safe? - # # => false - # - # ["".html_safe].html_safe? - # # => true - # - def html_safe? - detect { |e| !e.html_safe? }.nil? - end -end -- cgit v1.2.3