Class: Rails::HTML::Sanitizer

Inherits:
Object
  • Object
show all
Extended by:
Rails::HTML4::Sanitizer::VendorMethods
Defined in:
lib/rails/html/sanitizer.rb,
lib/rails/html/sanitizer/version.rb

Constant Summary collapse

VERSION =
"1.6.2"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Rails::HTML4::Sanitizer::VendorMethods

full_sanitizer, link_sanitizer, safe_list_sanitizer, white_list_sanitizer

Class Method Details

.best_supported_vendorObject



13
14
15
# File 'lib/rails/html/sanitizer.rb', line 13

def best_supported_vendor
  html5_support? ? Rails::HTML5::Sanitizer : Rails::HTML4::Sanitizer
end

.html5_support?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/rails/html/sanitizer.rb', line 7

def html5_support?
  return @html5_support if defined?(@html5_support)

  @html5_support = Loofah.respond_to?(:html5_support?) && Loofah.html5_support?
end

Instance Method Details

#sanitize(html, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/rails/html/sanitizer.rb', line 18

def sanitize(html, options = {})
  raise NotImplementedError, "subclasses must implement sanitize method."
end