Class: Stupidedi::Schema::Generation::Models::TableDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/stupidedi/schema/generation/models.rb

Overview

A heading/detail/summary table. #area is the lowercase enum name ("heading"/"detail"/"summary"); #name is the display name. #children is a mixed, ordered list of SegmentUse and LoopDefinition.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#areaObject

Returns the value of attribute area

Returns:

  • (Object)

    the current value of area



54
55
56
# File 'lib/stupidedi/schema/generation/models.rb', line 54

def area
  @area
end

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



54
55
56
# File 'lib/stupidedi/schema/generation/models.rb', line 54

def children
  @children
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



54
55
56
# File 'lib/stupidedi/schema/generation/models.rb', line 54

def name
  @name
end

#positionObject

Returns the value of attribute position

Returns:

  • (Object)

    the current value of position



54
55
56
# File 'lib/stupidedi/schema/generation/models.rb', line 54

def position
  @position
end

Instance Method Details

#ordered_childrenObject



55
56
57
58
59
# File 'lib/stupidedi/schema/generation/models.rb', line 55

def ordered_children
  # Index tiebreaker keeps ordering deterministic if two children ever
  # share a position (Ruby's sort_by is not stable).
  children.each_with_index.sort_by { |child, i| [child.position, i] }.map(&:first)
end