Module: TreeSitterLanguagePack::DocstringFormat
- Extended by:
- T::Helpers, T::Sig
- Included in:
- DocstringFormatGoDoc, DocstringFormatJSDoc, DocstringFormatJavaDoc, DocstringFormatOther, DocstringFormatPythonTripleQuote, DocstringFormatRustdoc
- Defined in:
- lib/tree_sitter_language_pack/native.rb
Overview
The format of a docstring extracted from source code.
Identifies the docstring convention used, which varies by language (e.g., Python triple-quoted strings, JSDoc, Rustdoc ‘///` comments).
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/tree_sitter_language_pack/native.rb', line 439 def self.from_hash(hash) discriminator = hash[:kind] || hash["kind"] case discriminator when "python_triple_quote" then DocstringFormatPythonTripleQuote.from_hash(hash) when "js_doc" then DocstringFormatJSDoc.from_hash(hash) when "rustdoc" then DocstringFormatRustdoc.from_hash(hash) when "go_doc" then DocstringFormatGoDoc.from_hash(hash) when "java_doc" then DocstringFormatJavaDoc.from_hash(hash) when "other" then DocstringFormatOther.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |