Eno::List » #items

items → array
items(options) → array
items(loader_proc, options) → array
items(options) { |name, value| loader_block } → array

Retrieve the items of the list, optionally passing them through a loader block or Proc. Note that when you provide both a block and a Proc the block takes precedence.

enocolors:
- pink
- peach
rubydocument = Eno.parse(input)
list = document.element('colors')

list.items()  #=> ['pink', 'peach']

list.items(Proc.new { |name, value| "#{value}!!" })  #=> ['pink!!', 'peach!!']

list.items { |name, value| { "#{value}!!" }  #=> ['pink!!', 'peach!!']

Parameters

loader_block or loader_proc

A Proc or block returning the transformed/validated value or raising an error.(The Proc or block is applied to each list item on its own, with a dynamic argumentsignature that allows to use |value| or |name, value| based on your needs.

options

elements

Whether to return the elements (as Eno::Field) instead of the values of the list items. (defaults to false)

enforce_values

Whether empty list items (- in the document, mapping to nil) are disallowed (defaults to true)

with_elements

Whether to return an array of arrays of the form [element, value] instead of just the values (defaults to false)

Return value

The (optionally transformed/validated) items of this list as an array.