Sha256: 10b44a9c14237dc6864b28f30bf416a81bef271f992837c0bf1f7b0f002c2493

Contents?: true

Size: 427 Bytes

Versions: 12

Compression:

Stored size: 427 Bytes

Contents

# frozen_string_literal: true

module HTML
  class Pipeline
    class TextFilter < Filter
      attr_reader :text

      def initialize(text, context = nil, result = nil)
        raise TypeError, 'text cannot be HTML' if text.is_a?(DocumentFragment)
        # Ensure that this is always a string
        @text = text.respond_to?(:to_str) ? text.to_str : text.to_s
        super nil, context, result
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
html-pipeline-2.14.3 lib/html/pipeline/text_filter.rb
html-pipeline-2.14.2 lib/html/pipeline/text_filter.rb
html-pipeline-2.14.1 lib/html/pipeline/text_filter.rb
html-pipeline-2.13.2 lib/html/pipeline/text_filter.rb
html-pipeline-2.13.1 lib/html/pipeline/text_filter.rb
html-pipeline-2.14.0 lib/html/pipeline/text_filter.rb
html-pipeline-2.13.0 lib/html/pipeline/text_filter.rb
html-pipeline-2.12.3 lib/html/pipeline/text_filter.rb
html-pipeline-2.12.2 lib/html/pipeline/text_filter.rb
html-pipeline-2.12.1 lib/html/pipeline/text_filter.rb
html-pipeline-2.12.0 lib/html/pipeline/text_filter.rb
html-pipeline-2.11.1 lib/html/pipeline/text_filter.rb