Module: Kreuzberg::AnnotationKind
- Extended by:
- T::Helpers, T::Sig
- Included in:
- AnnotationKindBold, AnnotationKindCode, AnnotationKindColor, AnnotationKindCustom, AnnotationKindFontSize, AnnotationKindHighlight, AnnotationKindItalic, AnnotationKindLink, AnnotationKindStrikethrough, AnnotationKindSubscript, AnnotationKindSuperscript, AnnotationKindUnderline
- Defined in:
- lib/kreuzberg/native.rb
Overview
Types of inline text annotations.
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 |
# File 'lib/kreuzberg/native.rb', line 1891 def self.from_hash(hash) discriminator = hash[:annotation_type] || hash["annotation_type"] case discriminator when "bold" then AnnotationKindBold.from_hash(hash) when "italic" then AnnotationKindItalic.from_hash(hash) when "underline" then AnnotationKindUnderline.from_hash(hash) when "strikethrough" then AnnotationKindStrikethrough.from_hash(hash) when "code" then AnnotationKindCode.from_hash(hash) when "subscript" then AnnotationKindSubscript.from_hash(hash) when "superscript" then AnnotationKindSuperscript.from_hash(hash) when "link" then AnnotationKindLink.from_hash(hash) when "highlight" then AnnotationKindHighlight.from_hash(hash) when "color" then AnnotationKindColor.from_hash(hash) when "font_size" then AnnotationKindFontSize.from_hash(hash) when "custom" then AnnotationKindCustom.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |