Eno::Section » #elements

elements → array

Retrieve the elements of this section in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing sections within, or the whole document, to represent document-like structures (think generic markup) instead of just associative data stores.

enodate: 2018-03-01
title: My blog post

# page

h1: Hello world
p: This is my first post, I'm so happy!
rubydocument = Eno.parse(input)

metadata = {
  date: document.field('date', my_date_loader_proc),
  title: document.field('title')
}

html = ''

document.section('page').elements.each do |element|
  html += "<#{element.name}>#{element.value}</#{element.name}>"
end

File.write('index.html', html)

Return value

An array containing the elements of this section.