Class: Stupidedi::Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::L
Overview
List Conditional: if the first element specified in the condition is present, then at least one of the remaining elements must be present
Instance Attribute Summary
#indexes
Class Method Summary
collapse
Instance Method Summary
collapse
#errors, #initialize, #satisfied?
Class Method Details
.build(*args) ⇒ Object
165
166
167
|
# File 'lib/stupidedi/versions/functional_groups/003050/syntax_notes.rb', line 165
def build(*args)
new(args)
end
|
Instance Method Details
#forbidden(zipper) ⇒ Object
155
156
157
|
# File 'lib/stupidedi/versions/functional_groups/003050/syntax_notes.rb', line 155
def forbidden(zipper)
[]
end
|
#reason(zipper) ⇒ Object
159
160
161
|
# File 'lib/stupidedi/versions/functional_groups/003050/syntax_notes.rb', line 159
def reason(zipper)
"at least one of elements #{indexes.tail.join(", ")} must be present when element #{indexes.head} is present"
end
|
#required(zipper) ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
153
|
# File 'lib/stupidedi/versions/functional_groups/003050/syntax_notes.rb', line 142
def required(zipper)
if zipper.node.present?
if zipper.child(indexes.head - 1).node.present?
xs = children(zipper).tail
xs.any?{|x| x.node.present? } ? [] : xs
else
[]
end
else
[]
end
end
|