the_one multimethod
Methods
- the_one(e:Eachable1, pattern:Any=method, body:Fun=method, found_more:Any=block, found_none:Any=block) Source: stdlib.ngs:1601
Find the only element that matches the pattern and execute given code with the value Parameters
body The code to execute when exactly one element that matches the pattern was found. Executed with the found value. It's value will be returned as result of the_one(). found_more The code to execute when more than one element matches the pattern. It's value will be returned as result of the_one(). Defaults to throwing an exception. found_none The code to execute when none of the elements match the pattern. It's value will be returned as result of the_one(). Defaults to exception. Returns
Result of running on of the following: body, found_more, found_noneExample
F name(dn:MethodDocNode) { dn.children.the_one(MethodNameDocNode).text[0] }