Class: HTMLPipeline::TextFilter
- Defined in:
- lib/html_pipeline/text_filter.rb,
lib/html_pipeline/text_filter/image_filter.rb,
lib/html_pipeline/text_filter/plain_text_input_filter.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ImageFilter, PlainTextInputFilter
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Filter
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context: {}, result: {}) ⇒ TextFilter
constructor
A new instance of TextFilter.
Methods inherited from Filter
#base_url, #call, #has_ancestor?, #needs, #validate
Constructor Details
#initialize(context: {}, result: {}) ⇒ TextFilter
Returns a new instance of TextFilter.
7 8 9 |
# File 'lib/html_pipeline/text_filter.rb', line 7 def initialize(context: {}, result: {}) super end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/html_pipeline/text_filter.rb', line 5 def text @text end |
Class Method Details
.call(text, context: {}, result: {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/html_pipeline/text_filter.rb', line 12 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 |