Module: SortingTableFor::Tools

Extended by:
Tools
Included in:
Tools
Defined in:
lib/sorting_table_for/tools.rb

Instance Method Summary collapse

Instance Method Details

#html_safe(text) ⇒ String

Returns the given text, marked as being HTML-safe. With older versions of the Rails XSS-safety mechanism, this destructively modifies the HTML-safety of ‘text`.

Parameters:

  • text (String)

Returns:

  • (String)

    ‘text`, marked as HTML-safe



19
20
21
22
23
24
# File 'lib/sorting_table_for/tools.rb', line 19

def html_safe(text)
  return text if !text
  return text.html_safe if defined?(ActiveSupport::SafeBuffer)
  return text.html_safe! if text.respond_to?(:html_safe!)
  text
end

#rails_safe_buffer_classObject



26
27
28
29
30
31
32
# File 'lib/sorting_table_for/tools.rb', line 26

def rails_safe_buffer_class
  # It's important that we check ActiveSupport first,
  # because in Rails 2.3.6 ActionView::SafeBuffer exists
  # but is a deprecated proxy object.
  return ActiveSupport::SafeBuffer if defined?(ActiveSupport::SafeBuffer)
  return ActionView::SafeBuffer
end