Class: Stupidedi::Schema::Generation::Models::LoopDefinition

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

Overview

A loop within a table or another loop. #children nests recursively. #max_reps is nil for unbounded.

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



64
65
66
# File 'lib/stupidedi/schema/generation/models.rb', line 64

def children
  @children
end

#identifierObject

Returns the value of attribute identifier

Returns:

  • (Object)

    the current value of identifier



64
65
66
# File 'lib/stupidedi/schema/generation/models.rb', line 64

def identifier
  @identifier
end

#max_repsObject

Returns the value of attribute max_reps

Returns:

  • (Object)

    the current value of max_reps



64
65
66
# File 'lib/stupidedi/schema/generation/models.rb', line 64

def max_reps
  @max_reps
end

#positionObject

Returns the value of attribute position

Returns:

  • (Object)

    the current value of position



64
65
66
# File 'lib/stupidedi/schema/generation/models.rb', line 64

def position
  @position
end

Instance Method Details

#ordered_childrenObject



65
66
67
# File 'lib/stupidedi/schema/generation/models.rb', line 65

def ordered_children
  children.each_with_index.sort_by { |child, i| [child.position, i] }.map(&:first)
end

#segment_use?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/stupidedi/schema/generation/models.rb', line 69

def segment_use?
  false
end