Class: ActiveFacts::Metamodel::TypeInheritance

Inherits:
FactType
  • Object
show all
Defined in:
lib/activefacts/metamodel/metamodel.rb,
lib/activefacts/metamodel/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, #default_reading, #internal_presence_constraints, #is_existential, #is_unary, #preferred_reading, #reading_preferably_starting_with_role

Instance Method Details

#describe(role = nil) ⇒ Object



1253
1254
1255
# File 'lib/activefacts/metamodel/extensions.rb', line 1253

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

#subtype_roleObject



1261
1262
1263
# File 'lib/activefacts/metamodel/extensions.rb', line 1261

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

#supertype_roleObject



1257
1258
1259
# File 'lib/activefacts/metamodel/extensions.rb', line 1257

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