Eno::Section » #section

section(name) → Eno::Section or nil
section(name, options) → Eno::Section or nil

Retrieve the subsection with the specified name from this current section.

eno# content
title: A Manifest

# notes
rubydocument = Eno.parse(input)

document.section('content')   #=> #<Eno::Section name="content" elements=1>
document.section('notes')     #=> #<Eno::Section name="notes" elements=0>
document.section('metadata')  # raises an error

document.section('metadata', required: false)        #=> nil
document.section('notes', enforce_element: true)     #=> #<Eno::Section name="notes" elements=0>
document.section('metadata', enforce_element: true)  # raises an error

Parameters

name

A string specifying the name of the section to retrieve.

options

enforce_element

Whether the section must be present in the document (defaults to false)

required

Alias for enforce_element (this exists on many methods and depending on context refers to either element or value)

Return value

An Eno::Section, or nil.