Class: Stupidedi::Versions::FunctionalGroups::ThirtyTen::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
#errors, #initialize, #satisfied?
Class Method Details
.build(*args) ⇒ Object
73
74
75
|
# File 'lib/stupidedi/versions/functional_groups/003010/syntax_notes.rb', line 73
def build(*args)
new(args)
end
|
Instance Method Details
#forbidden(zipper) ⇒ Object
61
62
63
|
# File 'lib/stupidedi/versions/functional_groups/003010/syntax_notes.rb', line 61
def forbidden(zipper)
[]
end
|
#reason(zipper) ⇒ Object
65
66
67
68
69
|
# File 'lib/stupidedi/versions/functional_groups/003010/syntax_notes.rb', line 65
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 when elements #{present.join(", ")} are present"
end
|
#required(zipper) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/stupidedi/versions/functional_groups/003010/syntax_notes.rb', line 52
def required(zipper)
if zipper.node.present?
xs = children(zipper)
xs.any?{|x| x.node.present? } ? [] : xs
else
[]
end
end
|