Class: DiffRenderer::ParagraphBlock::ChangedParagraph
- Inherits:
-
Object
- Object
- DiffRenderer::ParagraphBlock::ChangedParagraph
- Includes:
- WordRunDiffLCS
- Defined in:
- lib/diffrenderer/paragraph_block.rb
Defined Under Namespace
Classes: HtmlText
Instance Method Summary collapse
-
#initialize(context_change) ⇒ ChangedParagraph
constructor
A new instance of ChangedParagraph.
- #to_s ⇒ Object
Constructor Details
#initialize(context_change) ⇒ ChangedParagraph
Returns a new instance of ChangedParagraph.
120 121 122 |
# File 'lib/diffrenderer/paragraph_block.rb', line 120 def initialize(context_change) @context_change = context_change end |
Instance Method Details
#to_s ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/diffrenderer/paragraph_block.rb', line 124 def to_s if significant_change? && !all_additions_or_removals? removed_paragraph = ReplacedParagraph.new(@context_change) added_paragraph = AddedParagraph.new(@context_change) removed_paragraph.to_s + added_paragraph.to_s else words = word_run_level_sdiff.map { |context_change| HtmlText.new(context_change) } HtmlParagraph.new(words.join(" ")).to_s end end |