Class: Rails::HTML::Sanitizer
Constant Summary
collapse
- VERSION =
"1.7.0"
Class Method Summary
collapse
Instance Method Summary
collapse
full_sanitizer, link_sanitizer, safe_list_sanitizer, white_list_sanitizer
Class Method Details
.allowed_uri?(uri_string) ⇒ Boolean
17
18
19
|
# File 'lib/rails/html/sanitizer.rb', line 17
def allowed_uri?(uri_string)
Loofah::HTML5::Scrub.allowed_uri?(uri_string)
end
|
.best_supported_vendor ⇒ Object
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
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
22
23
24
|
# File 'lib/rails/html/sanitizer.rb', line 22
def sanitize(html, options = {})
raise NotImplementedError, "subclasses must implement sanitize method."
end
|