Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageruby
title#record examples
Krikri::Mapper.define(:my_mapping) do
  sourceResource class: DPLA::MAP::SourceResource do
    title record.field('dc:title')
  end
end


Krikri::Mapper.define(:my_mapping) do
  sourceResource class: DPLA::MAP::SourceResource do
    contributor class: DPLA::MAP::Agent,
                each:  record.field('item, 'contributor').reject_attribute(:role, 'creator'),
                as:    :contrib do
      providedLabel contrib.field('name')
    end
  end
end
Info
titleDelayed Calls

Delayed access to record values is provided through a RecordProxy. One of these proxies is returned by #record and #header. When the mapping is defined, the proxy a chain of Value Method calls, continually returning itself to receive the next call. At processing time, the stored call chain is replayed using the real parsed records to retrieve the values.

...