lib/traject/macros/transformation.rb
# Adds a literal to accumulator if accumulator was empty
#
# @example
#      to_field "title", extract_marc("245abc"), default("Unknown Title")
Adds a literal to accumulator if accumulator was empty
Adds a literal to accumulator if accumulator was empty
def default(default_value)
        lambda do |rec, acc|
          if acc.empty?
            acc << default_value
          end
        end
      end
def default ( default_value ) lambda do | rec , acc | if acc . empty? acc << default_value end end end
Adds a literal to accumulator if accumulator was empty
Adds a literal to accumulator if accumulator was empty
default_value
<not_specific>
example
to_field "title", extract_marc("245abc"), default("Unknown Title")
to_field " title " extract_marc ( " 245abc " ) default ( " Unknown Title " )