Class: Opencdd::Validator::HierarchyRule
- Inherits:
-
Rule
- Object
- Rule
- Opencdd::Validator::HierarchyRule
show all
- Defined in:
- lib/opencdd/validator/hierarchy_rule.rb
Constant Summary
Constants inherited
from Rule
Rule::REFERENCE_VALUE_KINDS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Rule
#blank?, #code_column?, #message, #reference_kind?, #skip_blank?, #value_passes?
Class Method Details
.class_hierarchy_acyclic?(database) ⇒ Boolean
18
19
20
21
22
23
|
# File 'lib/opencdd/validator/hierarchy_rule.rb', line 18
def self.class_hierarchy_acyclic?(database)
database.classes.each do |klass|
return false if cycle_from?(klass, database)
end
true
end
|
.composition_hierarchy_acyclic?(database) ⇒ Boolean
25
26
27
28
29
30
31
|
# File 'lib/opencdd/validator/hierarchy_rule.rb', line 25
def self.composition_hierarchy_acyclic?(database)
visited = {}
database.classes.each do |klass|
return false if composition_cycle?(klass, database, visited, [])
end
true
end
|
Instance Method Details
#applies?(_context) ⇒ Boolean
10
11
12
|
# File 'lib/opencdd/validator/hierarchy_rule.rb', line 10
def applies?(_context)
false
end
|
#call(_value, _context) ⇒ Object
14
15
16
|
# File 'lib/opencdd/validator/hierarchy_rule.rb', line 14
def call(_value, _context)
true
end
|
#id ⇒ Object
6
7
8
|
# File 'lib/opencdd/validator/hierarchy_rule.rb', line 6
def id
"R14"
end
|