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
3220 3221 3222 3223 3224 3225 3226 3227 3228 |
# File 'lib/kreuzberg/native.rb', line 3220 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 |