Sha256: 48c7ab466a0ccd307e1bbdb3df4bdf320b42acb9f83898424aabf7466221db72
Contents?: true
Size: 538 Bytes
Versions: 3
Compression:
Stored size: 538 Bytes
Contents
# frozen_string_literal: true class HTMLPipeline class TextFilter < Filter attr_reader :text def initialize(context: {}, result: {}) super(context: context, result: result) end class << self def call(text, context: {}, result: {}) raise TypeError, "text must be a String" unless text.is_a?(String) # Ensure that this is always a string text = text.respond_to?(:to_str) ? text.to_str : text.to_s new(context: context, result: result).call(text) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
html-pipeline-3.2.0 | lib/html_pipeline/text_filter.rb |
html-pipeline-3.1.1 | lib/html_pipeline/text_filter.rb |
html-pipeline-3.1.0 | lib/html_pipeline/text_filter.rb |