Class: ActiveFacts::Metamodel::TypeInheritance

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

Instance Attribute Summary

Attributes inherited from FactType

#check_and_add_spanning_uniqueness_constraint

Instance Method Summary collapse

Methods inherited from FactType

#all_reading_by_ordinal, #all_role_in_order, #compatible_readings, #create_implicit_fact_type_for_unary, #default_reading, #implicit_boolean_type, #internal_presence_constraints, #is_existential, #preferred_reading, #reading_preferably_starting_with_role

Instance Method Details

#describe(role = nil) ⇒ Object



703
704
705
# File 'lib/activefacts/vocabulary/extensions.rb', line 703

def describe(role = nil)
  "#{subtype.name} is a kind of #{supertype.name}"
end

#subtype_roleObject



711
712
713
# File 'lib/activefacts/vocabulary/extensions.rb', line 711

def subtype_role
  (roles = all_role.to_a)[0].object_type == subtype ? roles[0] : roles[1]
end

#supertype_roleObject



707
708
709
# File 'lib/activefacts/vocabulary/extensions.rb', line 707

def supertype_role
  (roles = all_role.to_a)[0].object_type == supertype ? roles[0] : roles[1]
end