Class: Stupidedi::Versions::FunctionalGroups::FortyTen::SyntaxNotes::P
Overview
Paired or Multiple: if any element specified in the relational condition is present, then all of the elements specified must be present.
Instance Attribute Summary
#indexes
Class Method Summary
collapse
Instance Method Summary
collapse
#errors, #initialize, #satisfied?
Class Method Details
.build(*args) ⇒ Object
42
43
44
|
# File 'lib/stupidedi/versions/functional_groups/004010/syntax_notes.rb', line 42
def build(*args)
new(args)
end
|
Instance Method Details
#forbidden(zipper) ⇒ Object
30
31
32
|
# File 'lib/stupidedi/versions/functional_groups/004010/syntax_notes.rb', line 30
def forbidden(zipper)
[]
end
|
#reason(zipper) ⇒ Object
34
35
36
37
38
|
# File 'lib/stupidedi/versions/functional_groups/004010/syntax_notes.rb', line 34
def reason(zipper)
present = indexes.select{|n| zipper.child(n - 1).node.present? }
missing = indexes - present
"elements #{missing.join(", ")} must be present when elements #{present.join(", ")} are present"
end
|
#required(zipper) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/stupidedi/versions/functional_groups/004010/syntax_notes.rb', line 21
def required(zipper)
if zipper.node.present?
xs = children(zipper)
xs.any?{|x| x.node.present? } ? xs : []
else
[]
end
end
|