Class: TreeHaver::KaitaiTreeNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/tree_haver/contracts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



426
427
428
# File 'lib/tree_haver/contracts.rb', line 426

def children
  @children
end

#fieldsObject

Returns the value of attribute fields

Returns:

  • (Object)

    the current value of fields



426
427
428
# File 'lib/tree_haver/contracts.rb', line 426

def fields
  @fields
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



426
427
428
# File 'lib/tree_haver/contracts.rb', line 426

def kind
  @kind
end

#schema_pathObject

Returns the value of attribute schema_path

Returns:

  • (Object)

    the current value of schema_path



426
427
428
# File 'lib/tree_haver/contracts.rb', line 426

def schema_path
  @schema_path
end

#spanObject

Returns the value of attribute span

Returns:

  • (Object)

    the current value of span



426
427
428
# File 'lib/tree_haver/contracts.rb', line 426

def span
  @span
end

Instance Method Details

#to_hObject



427
428
429
430
431
432
433
434
435
# File 'lib/tree_haver/contracts.rb', line 427

def to_h
  {
    kind: kind,
    schema_path: schema_path,
    span: span.to_h,
    fields: deep_dup(fields || {}),
    children: (children || []).map(&:to_h)
  }
end