Class: Stupidedi::Versions::Common::SyntaxNotes::R
Overview
Required: at least one of the elements specified in the condition
must be present
Instance Attribute Summary
#indexes
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, #satisfied?
Class Method Details
.build(*args)
147
148
149
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 147
def build(*args)
new(args)
end
|
Instance Method Details
#forbidden(zipper)
52
53
54
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 52
def forbidden(zipper)
[]
end
|
#reason(zipper)
56
57
58
59
60
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 56
def reason(zipper)
present = indexes.select{|n| zipper.child(n - 1).node.present? }
missing = indexes - present
"at least one of elements #{missing.join(", ")} must be present"
end
|
#required(zipper)
43
44
45
46
47
48
49
50
|
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 43
def required(zipper)
xs = children(zipper)
xs.any?{|x| x.node.present? } ? [] : xs
end
|