Class: Xberg::FormatMetadataCode
- Inherits:
-
Data
- Object
- Data
- Xberg::FormatMetadataCode
- Extended by:
- T::Sig
- Includes:
- FormatMetadata
- Defined in:
- lib/xberg/native.rb
Overview
Code (tree-sitter analyzable source). Carries the structural chunks (function,
class, and module boundaries) produced by the tree-sitter extractor, consumed by
the chunking pipeline to emit structure-aware Chunks instead of falling back to
text-based splitting.
Wraps [CodeMetadata] (a named struct) rather than Vec<CodeChunkInfo> directly:
FormatMetadata is internally tagged (#[serde(tag = "format_type")]), and serde
cannot serialize a tagged newtype variant that wraps a sequence — the tag has no
map to live in. Wrapping a struct gives serde a map to hold the tag, and keeps this
variant shape consistent with every sibling (Variant(XMetadata)) so the derived
OpenAPI discriminator can reference a named component schema.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #archive? ⇒ Boolean
- #audio? ⇒ Boolean
- #bibtex? ⇒ Boolean
- #citation? ⇒ Boolean
- #code? ⇒ Boolean
- #csv? ⇒ Boolean
- #dbf? ⇒ Boolean
- #docx? ⇒ Boolean
- #email? ⇒ Boolean
- #epub? ⇒ Boolean
- #excel? ⇒ Boolean
- #fiction_book? ⇒ Boolean
- #html? ⇒ Boolean
- #image? ⇒ Boolean
- #jats? ⇒ Boolean
- #ocr? ⇒ Boolean
- #pdf? ⇒ Boolean
- #pptx? ⇒ Boolean
- #pst? ⇒ Boolean
- #text? ⇒ Boolean
- #xml? ⇒ Boolean
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value
2501 2502 2503 |
# File 'lib/xberg/native.rb', line 2501 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
2553 2554 2555 2556 |
# File 'lib/xberg/native.rb', line 2553 def self.from_hash(hash) payload = hash.reject { |key, _| key.to_s == "format_type" }.transform_keys(&:to_sym) new(value: CodeMetadata.new(payload)) end |
Instance Method Details
#archive? ⇒ Boolean
2519 |
# File 'lib/xberg/native.rb', line 2519 def archive? = false |
#audio? ⇒ Boolean
2547 |
# File 'lib/xberg/native.rb', line 2547 def audio? = false |
#bibtex? ⇒ Boolean
2533 |
# File 'lib/xberg/native.rb', line 2533 def bibtex? = false |
#citation? ⇒ Boolean
2535 |
# File 'lib/xberg/native.rb', line 2535 def citation? = false |
#code? ⇒ Boolean
2549 2550 2551 |
# File 'lib/xberg/native.rb', line 2549 def code? = true # @param hash [Hash] deserialized from the native extension # @return [self] |
#csv? ⇒ Boolean
2531 |
# File 'lib/xberg/native.rb', line 2531 def csv? = false |
#dbf? ⇒ Boolean
2539 |
# File 'lib/xberg/native.rb', line 2539 def dbf? = false |
#docx? ⇒ Boolean
2511 |
# File 'lib/xberg/native.rb', line 2511 def docx? = false |
#email? ⇒ Boolean
2515 |
# File 'lib/xberg/native.rb', line 2515 def email? = false |
#epub? ⇒ Boolean
2543 |
# File 'lib/xberg/native.rb', line 2543 def epub? = false |
#excel? ⇒ Boolean
2513 |
# File 'lib/xberg/native.rb', line 2513 def excel? = false |
#fiction_book? ⇒ Boolean
2537 |
# File 'lib/xberg/native.rb', line 2537 def fiction_book? = false |
#html? ⇒ Boolean
2527 |
# File 'lib/xberg/native.rb', line 2527 def html? = false |
#image? ⇒ Boolean
2521 |
# File 'lib/xberg/native.rb', line 2521 def image? = false |
#jats? ⇒ Boolean
2541 |
# File 'lib/xberg/native.rb', line 2541 def jats? = false |
#ocr? ⇒ Boolean
2529 |
# File 'lib/xberg/native.rb', line 2529 def ocr? = false |
#pdf? ⇒ Boolean
2509 |
# File 'lib/xberg/native.rb', line 2509 def pdf? = false |
#pptx? ⇒ Boolean
2517 |
# File 'lib/xberg/native.rb', line 2517 def pptx? = false |
#pst? ⇒ Boolean
2545 |
# File 'lib/xberg/native.rb', line 2545 def pst? = false |
#text? ⇒ Boolean
2525 |
# File 'lib/xberg/native.rb', line 2525 def text? = false |
#xml? ⇒ Boolean
2523 |
# File 'lib/xberg/native.rb', line 2523 def xml? = false |