Sha256: e6155dc90da76928604a3575fd1246ca2279596a45632cfd00088ef73f30b951
Contents?: true
Size: 799 Bytes
Versions: 11
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true require "selma" class HTMLPipeline class NodeFilter < Filter def initialize(context: {}, result: {}) super(context: context, result: {}) send(:after_initialize) if respond_to?(:after_initialize) end # The String representation of the document. def html raise InvalidDocumentException if @html.nil? && @doc.nil? @html || doc.to_html end def reset! result = {} # rubocop:disable Lint/UselessAssignment send(:after_initialize) if respond_to?(:after_initialize) end class << self def call(html, context: {}, result: {}) node_filter = new(context: context, result: result) Selma::Rewriter.new(sanitizer: nil, handlers: [node_filter]).rewrite(html) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems