Module: TreeSitterLanguagePack::SymbolKind
- Extended by:
- T::Helpers, T::Sig
- Included in:
- SymbolKindClass, SymbolKindConstant, SymbolKindEnum, SymbolKindFunction, SymbolKindInterface, SymbolKindModule, SymbolKindOther, SymbolKindType, SymbolKindVariable
- Defined in:
- lib/tree_sitter_language_pack/native.rb
Overview
The kind of a symbol definition found in source code.
Categorizes symbol definitions such as variables, constants, functions, classes, types, interfaces, enums, and modules.
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/tree_sitter_language_pack/native.rb', line 616 def self.from_hash(hash) discriminator = hash[:kind] || hash["kind"] case discriminator when "variable" then SymbolKindVariable.from_hash(hash) when "constant" then SymbolKindConstant.from_hash(hash) when "function" then SymbolKindFunction.from_hash(hash) when "class" then SymbolKindClass.from_hash(hash) when "type" then SymbolKindType.from_hash(hash) when "interface" then SymbolKindInterface.from_hash(hash) when "enum" then SymbolKindEnum.from_hash(hash) when "module" then SymbolKindModule.from_hash(hash) when "other" then SymbolKindOther.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |