Class: RapidDiffs::Viewers::Text::LineContentComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/rapid_diffs/viewers/text/line_content_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(line:, position:) ⇒ LineContentComponent

Returns a new instance of LineContentComponent.



7
8
9
10
# File 'app/components/rapid_diffs/viewers/text/line_content_component.rb', line 7

def initialize(line:, position:)
  @line = line
  @position = position
end

Instance Method Details

#change_typeObject



12
13
14
15
16
17
18
# File 'app/components/rapid_diffs/viewers/text/line_content_component.rb', line 12

def change_type
  return unless @line
  return 'meta' if @line.meta?
  return 'added' if @line.added?

  'removed' if @line.removed?
end