# class HTML::Sanitizer

### Public Instance Methods

sanitize(text, options = {}) click to toggle source

    # File lib/action_controller/vendor/html-scanner/html/sanitizer.rb, line 7
    def sanitize(text, options = {})
      return text unless sanitizeable?(text)
      tokenize(text, options).join
    end

sanitizeable?(text) click to toggle source

    # File lib/action_controller/vendor/html-scanner/html/sanitizer.rb, line 12
    def sanitizeable?(text)
      !(text.nil? || text.empty? || !text.index("<"))
    end

### Protected Instance Methods

process_node(node, result, options) click to toggle source

    # File lib/action_controller/vendor/html-scanner/html/sanitizer.rb, line 27
    def process_node(node, result, options)
      result << node.to_s
    end

tokenize(text, options) click to toggle source

    # File lib/action_controller/vendor/html-scanner/html/sanitizer.rb, line 17
    def tokenize(text, options)
      tokenizer = HTML::Tokenizer.new(text)
      result = []
      while token = tokenizer.next
        node = Node.parse(nil, 0, 0, token, false)
        process_node node, result, options
      end
      result
    end