Class: HTML::Sanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/action_controller/vendor/html-scanner/html/sanitizer.rb

Direct Known Subclasses

FullSanitizer, WhiteListSanitizer

Instance Method Summary collapse

Instance Method Details

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



6
7
8
9
# File 'lib/action_controller/vendor/html-scanner/html/sanitizer.rb', line 6

def sanitize(text, options = {})
  return text unless sanitizeable?(text)
  tokenize(text, options).join
end

#sanitizeable?(text) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/action_controller/vendor/html-scanner/html/sanitizer.rb', line 11

def sanitizeable?(text)
  !(text.nil? || text.empty? || !text.index("<"))
end