Module: Kreuzberg::DiffLine

Extended by:
T::Helpers, T::Sig
Included in:
DiffLineAdded, DiffLineContext, DiffLineRemoved
Defined in:
lib/kreuzberg/native.rb

Overview

A single line in a unified-diff hunk.

Defined here (rather than only in ‘crate::diff`) so `RevisionDelta` can reference it unconditionally, without requiring the `diff` Cargo feature. `crate::diff` re-exports this type verbatim.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



3685
3686
3687
3688
3689
3690
3691
3692
3693
# File 'lib/kreuzberg/native.rb', line 3685

def self.from_hash(hash)
  discriminator = hash[:kind] || hash["kind"]
  case discriminator
  when "context" then DiffLineContext.from_hash(hash)
  when "added" then DiffLineAdded.from_hash(hash)
  when "removed" then DiffLineRemoved.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end