NAME

Catmandu::Fix::Bind::each - a binder that executes fixes for every (key, value) pair in a hash

SYNOPSIS

# Create a hash:
# demo:
#   nl: 'Tuin der lusten'
#   en: 'The Garden of Earthly Delights'

# Create a list of all the titles, without the language tags.
do each(path: demo, var: t)
    copy_field(t.value, titles.$append)
end

# This will result in:
# demo:
#   nl: 'Tuin der lusten'
#   en: 'The Garden of Earthly Delights'
# titles:
#   - 'Tuin der lusten'
#   - 'The Garden of Earthly Delights'

DESCRIPTION

The each binder will iterate over a hash and return a (key, value) pair (see the Perl each function for the inspiration for this bind) and execute all fixes for each pair.

The bind always returns a var.key and var.value pair which can be used in the fixes.

CONFIGURATION

path

The path to a hash in the data.

var

The temporary field that will be created in the root of the record containing a key and value field containing the key and value of the iterated data (cfr. each).

SEE ALSO

Catmandu::Fix::Bind::list Catmandu::Fix::Bind