lib/traject/macros/transformation.rb
# Removes all but the first value from accumulator, if more values were present.
#
# @example
#     to_field "main_author", extract_marc("100"), first_only
Removes all but the first value from accumulator, if more values were present.
Removes all but the first value from accumulator if more values were present .
def first_only
        lambda do |rec, acc|
          acc.slice!(1, acc.length)
        end
      end
def first_only lambda do | rec , acc | acc . slice! ( 1 , acc . length ) end end
Removes all but the first value from accumulator, if more values were present.
Removes all but the first value from accumulator if more values were present .
# kind of esoteric, but slice used this way does mutating first, yep
example
to_field "main_author", extract_marc("100"), first_only
to_field " main_author " extract_marc ( " 100 " ) first_only