Module: Kreuzberg::RevisionAnchor

Extended by:
T::Helpers, T::Sig
Included in:
RevisionAnchorPage, RevisionAnchorParagraph, RevisionAnchorSheet, RevisionAnchorSlide, RevisionAnchorTableCell
Defined in:
lib/kreuzberg/native.rb

Overview

Best-effort document location for a revision.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
# File 'lib/kreuzberg/native.rb', line 3772

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "paragraph" then RevisionAnchorParagraph.from_hash(hash)
  when "table_cell" then RevisionAnchorTableCell.from_hash(hash)
  when "page" then RevisionAnchorPage.from_hash(hash)
  when "slide" then RevisionAnchorSlide.from_hash(hash)
  when "sheet" then RevisionAnchorSheet.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end