Class: DiffRenderer::ParagraphBlock::ChangedParagraph::HtmlText

Inherits:
Object
  • Object
show all
Defined in:
lib/diffrenderer/paragraph_block.rb

Defined Under Namespace

Classes: HtmlSpan

Instance Method Summary collapse

Constructor Details

#initialize(context_change) ⇒ HtmlText

Returns a new instance of HtmlText.



93
94
95
# File 'lib/diffrenderer/paragraph_block.rb', line 93

def initialize(context_change)
  @context_change = context_change
end

Instance Method Details

#to_sObject



97
98
99
100
101
102
103
104
# File 'lib/diffrenderer/paragraph_block.rb', line 97

def to_s
  case @context_change.action
    when "=" then old_text
    when "-" then removed_span
    when "+" then added_span
    when "!" then "#{removed_span} #{added_span}"
  end.to_s
end