class ActiveFacts::Metamodel::ValueType
Public Instance Methods
all_subtype()
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 511 def all_subtype all_value_type_as_supertype end
Also aliased as: subtypes
all_supertype()
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 503 def all_supertype Array(supertype) end
all_value_type_parameter_transitive()
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 537 def all_value_type_parameter_transitive supertypes_transitive.flat_map{|st| st.all_value_type_parameter.to_a} end
applicable_parameter_restrictions(parameter_name, include_base_type = false)
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 541 def applicable_parameter_restrictions parameter_name, include_base_type = false vtp = all_value_type_parameter_transitive.detect{|vtp| vtp.name == parameter_name } return [] if !vtp || vtp.value_type == self vtpr = all_value_type_parameter_restriction.select{|vtpr| vtpr.value_type_parameter == vtp } if vtpr.empty? supertype.applicable_parameter_restrictions parameter_name else vtpr end end
common_supertype(other)
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 520 def common_supertype(other) return nil unless other.is_a?(ActiveFacts::Metamodel::ValueType) return self if other.supertypes_transitive.include?(self) return other if supertypes_transitive.include(other) nil end
is_auto_assigned()
click to toggle source
Is this ValueType
auto-assigned? Returns either 'assert', 'commit', otherwise nil.
# File lib/activefacts/metamodel/extensions.rb, line 528 def is_auto_assigned type = self while type return type.transaction_phase || 'commit' if type.name =~ /^Auto/ || type.transaction_phase type = type.supertype end nil end
subtypes_transitive()
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 516 def subtypes_transitive [self] + subtypes.map{|st| st.subtypes_transitive}.flatten end
supertypes_transitive()
click to toggle source
# File lib/activefacts/metamodel/extensions.rb, line 507 def supertypes_transitive [self] + (supertype ? supertype.supertypes_transitive : []) end