Class: ActiveFacts::Metamodel::Discriminator

Inherits:
Component
  • Object
show all
Defined in:
lib/activefacts/metamodel/metamodel.rb,
lib/activefacts/metamodel/extensions.rb

Constant Summary

Constants inherited from Component

Component::RANK_DISCRIMINATOR, Component::RANK_FOREIGN, Component::RANK_IDENT, Component::RANK_INDICATOR, Component::RANK_INJECTION, Component::RANK_MANDATORY, Component::RANK_MULTIPLE, Component::RANK_NON_MANDATORY, Component::RANK_SCOPING, Component::RANK_SUBTYPE, Component::RANK_SUPER, Component::RANK_SURROGATE, Component::RANK_VALUE

Instance Method Summary collapse

Methods inherited from Component

#comment, #data_type, #depth, #fork_to_new_parent, #in_foreign_key, #in_primary_index, #is_auto_assigned, #is_mandatory, #leaves, #narrow_value_constraint, #parent_entity_type, #path, #path_mandatory, #primary_index_components, #rank_key, #rank_kind, #rank_path, #root, #uncache_rank_key

Instance Method Details

#all_roleObject



2024
2025
2026
# File 'lib/activefacts/metamodel/extensions.rb', line 2024

def all_role
  all_discriminated_role.map(&:role).flat_map{|role| [role, role.base_role]}.uniq
end

#inspectObject



2016
2017
2018
# File 'lib/activefacts/metamodel/extensions.rb', line 2016

def inspect
  "#{self.class.basename} between #{all_discriminated_role.map{|dr|dr.fact_type.default_reading.inspect}*', '}"
end

#show_traceObject



2020
2021
2022
# File 'lib/activefacts/metamodel/extensions.rb', line 2020

def show_trace
  trace :composition, "#{ordinal ? "#{ordinal}: " : ''}#{inspect} #{name ? " (as #{name.inspect})" : ''}"
end