Class: Yuzu::PostProcessors::ContentsWithoutFirstParagraphPostProcessor
- Inherits:
-
PostProcessor
- Object
- Register
- PostProcessor
- Yuzu::PostProcessors::ContentsWithoutFirstParagraphPostProcessor
- Defined in:
- lib/yuzu/postprocessors/contents_without_first_paragraph.rb
Instance Attribute Summary
Attributes inherited from PostProcessor
Instance Method Summary collapse
-
#initialize ⇒ ContentsWithoutFirstParagraphPostProcessor
constructor
A new instance of ContentsWithoutFirstParagraphPostProcessor.
- #match(contents) ⇒ Object
- #regex ⇒ Object
Methods inherited from PostProcessor
postprocessors, registry, #value
Constructor Details
#initialize ⇒ ContentsWithoutFirstParagraphPostProcessor
Returns a new instance of ContentsWithoutFirstParagraphPostProcessor.
5 6 7 8 |
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 5 def initialize @name = :contents_without_first_paragraph @directive = "CONTENTSWITHOUTFIRSTPARAGRAPH" end |
Instance Method Details
#match(contents) ⇒ Object
14 15 16 |
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 14 def match(contents) contents.sub(regex, "") end |
#regex ⇒ Object
10 11 12 |
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 10 def regex /<p\b[^>]*?>(.*?)<\/p>/n end |