Module: Lutaml::Lml::EntityTypes

Defined in:
lib/lutaml/lml/entity_types.rb

Overview

Single source of truth for entity types held on a Document. Each entity model declares self.entity_type (the Document collection name); consumers iterate this registry instead of hardcoding the type list in four places.

Constant Summary collapse

ALL =
[UmlClass, Enum, DataType, PrimitiveType].freeze

Class Method Summary collapse

Class Method Details

.allObject



12
13
14
# File 'lib/lutaml/lml/entity_types.rb', line 12

def self.all
  ALL
end

.by_symbolObject



16
17
18
# File 'lib/lutaml/lml/entity_types.rb', line 16

def self.by_symbol
  @by_symbol ||= ALL.each_with_object({}) { |klass, index| index[klass.entity_type] = klass }
end

.classifiableObject

Entities that can own attributes/associations (excludes enums).



25
26
27
# File 'lib/lutaml/lml/entity_types.rb', line 25

def self.classifiable
  ALL.select(&:classifiable?)
end

.symbolsObject



20
21
22
# File 'lib/lutaml/lml/entity_types.rb', line 20

def self.symbols
  by_symbol.keys
end