Class: HTML::Pipeline::TextFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/html/pipeline/text_filter.rb

Instance Attribute Summary collapse

Attributes inherited from Filter

#context, #result

Instance Method Summary collapse

Methods inherited from Filter

#base_url, #call, call, #can_access_repo?, #current_user, #doc, #has_ancestor?, #html, #needs, #parse_html, #repository, to_document, to_html, #validate

Constructor Details

#initialize(text, context = nil, result = nil) ⇒ TextFilter

Returns a new instance of TextFilter.

Raises:

  • (TypeError)


6
7
8
9
10
11
# File 'lib/html/pipeline/text_filter.rb', line 6

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

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/html/pipeline/text_filter.rb', line 4

def text
  @text
end