Class: Stupidedi::Versions::Common::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
#initialize, #satisfied?
Class Method Details
.build(*args)
141
142
143
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 141
def build(*args)
new(args)
end
|
Instance Method Details
#forbidden(zipper)
27
28
29
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 27
def forbidden(zipper)
[]
end
|
#reason(zipper)
31
32
33
34
35
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 31
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)
18
19
20
21
22
23
24
25
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 18
def required(zipper)
xs = children(zipper)
xs.any?{|x| x.node.present? } ? xs : []
end
|