Class: Xberg::FormatMetadataCode

Inherits:
Data
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Boolean)


2519
# File 'lib/xberg/native.rb', line 2519

def archive? = false

#audio?Boolean

Returns:

  • (Boolean)


2547
# File 'lib/xberg/native.rb', line 2547

def audio? = false

#bibtex?Boolean

Returns:

  • (Boolean)


2533
# File 'lib/xberg/native.rb', line 2533

def bibtex? = false

#citation?Boolean

Returns:

  • (Boolean)


2535
# File 'lib/xberg/native.rb', line 2535

def citation? = false

#code?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


2531
# File 'lib/xberg/native.rb', line 2531

def csv? = false

#dbf?Boolean

Returns:

  • (Boolean)


2539
# File 'lib/xberg/native.rb', line 2539

def dbf? = false

#docx?Boolean

Returns:

  • (Boolean)


2511
# File 'lib/xberg/native.rb', line 2511

def docx? = false

#email?Boolean

Returns:

  • (Boolean)


2515
# File 'lib/xberg/native.rb', line 2515

def email? = false

#epub?Boolean

Returns:

  • (Boolean)


2543
# File 'lib/xberg/native.rb', line 2543

def epub? = false

#excel?Boolean

Returns:

  • (Boolean)


2513
# File 'lib/xberg/native.rb', line 2513

def excel? = false

#fiction_book?Boolean

Returns:

  • (Boolean)


2537
# File 'lib/xberg/native.rb', line 2537

def fiction_book? = false

#html?Boolean

Returns:

  • (Boolean)


2527
# File 'lib/xberg/native.rb', line 2527

def html? = false

#image?Boolean

Returns:

  • (Boolean)


2521
# File 'lib/xberg/native.rb', line 2521

def image? = false

#jats?Boolean

Returns:

  • (Boolean)


2541
# File 'lib/xberg/native.rb', line 2541

def jats? = false

#ocr?Boolean

Returns:

  • (Boolean)


2529
# File 'lib/xberg/native.rb', line 2529

def ocr? = false

#pdf?Boolean

Returns:

  • (Boolean)


2509
# File 'lib/xberg/native.rb', line 2509

def pdf? = false

#pptx?Boolean

Returns:

  • (Boolean)


2517
# File 'lib/xberg/native.rb', line 2517

def pptx? = false

#pst?Boolean

Returns:

  • (Boolean)


2545
# File 'lib/xberg/native.rb', line 2545

def pst? = false

#text?Boolean

Returns:

  • (Boolean)


2525
# File 'lib/xberg/native.rb', line 2525

def text? = false

#xml?Boolean

Returns:

  • (Boolean)


2523
# File 'lib/xberg/native.rb', line 2523

def xml? = false