Class: TreeHaver::OrderedTreePrimitives

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#child_orderObject

Returns the value of attribute child_order

Returns:

  • (Object)

    the current value of child_order



259
260
261
# File 'lib/tree_haver/contracts.rb', line 259

def child_order
  @child_order
end

#diagnosticsObject

Returns the value of attribute diagnostics

Returns:

  • (Object)

    the current value of diagnostics



259
260
261
# File 'lib/tree_haver/contracts.rb', line 259

def diagnostics
  @diagnostics
end

#root_idObject

Returns the value of attribute root_id

Returns:

  • (Object)

    the current value of root_id



259
260
261
# File 'lib/tree_haver/contracts.rb', line 259

def root_id
  @root_id
end

#sibling_edgesObject

Returns the value of attribute sibling_edges

Returns:

  • (Object)

    the current value of sibling_edges



259
260
261
# File 'lib/tree_haver/contracts.rb', line 259

def sibling_edges
  @sibling_edges
end

Instance Method Details

#to_hObject



260
261
262
263
264
265
266
267
# File 'lib/tree_haver/contracts.rb', line 260

def to_h
  {
    root_id: root_id,
    child_order: child_order || {},
    sibling_edges: (sibling_edges || []).map(&:to_h),
    diagnostics: diagnostics || []
  }
end