Eno::Section ยป #enforce_all_elements

enforce_all_elements
enforce_all_elements(enforce)

Set the default for all following queries on this section of whether the presence of elements in the eno input text should be enforced (by default it is not). This can be used to prevent "template decay" - with presence enforcement enabled elements may be empty, but they (at least their declaration) must be there in the eno text and consequently they can not disappear from a template over time without triggering an error.

enocolor: blue
rubydocument = Eno.parse(input)

document.field('sound')  #=> nil

document.enforce_all_elements

document.field('sound')  # raises an error
document.field('sound', enforce_element: false)  #=> nil

Parameters

enforce

An optional boolean indicating whether to enforce or not. (otherwise true is assumed)