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



3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
# File 'lib/kreuzberg/native.rb', line 3307

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