lib/marc_cleanup/bib_rubymarc_fixes.rb
def empty_indicator_fix(record)
    record.fields.each do |field|
      next unless field.class == MARC::DataField
      if field.indicator1.nil?
        field.indicator1 = ' '
      else
        field.indicator1.scrub!('')
        field.indicator1 = ' ' if field.indicator1.size < 1
      end
      if field.indicator2.nil?
        field.indicator2 = ' '
      else
        field.indicator2.scrub!('')
        field.indicator2 = ' ' if field.indicator2.size < 1
      end
    end
    record
  end
### Replace empty indicators with a space;
#     scrub indicators with bad UTF-8
Replace empty indicators with a space;
scrub indicators with bad UTF-8
Replace empty indicators with a space ; scrub indicators with bad UTF - 8
def empty_indicator_fix(record)
    record.fields.each do |field|
      next unless field.class == MARC::DataField
      if field.indicator1.nil?
        field.indicator1 = ' '
      else
        field.indicator1.scrub!('')
        field.indicator1 = ' ' if field.indicator1.size < 1
      end
      if field.indicator2.nil?
        field.indicator2 = ' '
      else
        field.indicator2.scrub!('')
        field.indicator2 = ' ' if field.indicator2.size < 1
      end
    end
    record
  end
def empty_indicator_fix ( record ) record . fields . each do | field | next unless field . class == MARC :: DataField if field . indicator1 . nil? field . indicator1 = ' ' else field . indicator1 . scrub! ( '' ) field . indicator1 = ' ' if field . indicator1 . size < 1 end if field . indicator2 . nil? field . indicator2 = ' ' else field . indicator2 . scrub! ( '' ) field . indicator2 = ' ' if field . indicator2 . size < 1 end end record end
Replace empty indicators with a space;
scrub indicators with bad UTF-8
Replace empty indicators with a space ; scrub indicators with bad UTF - 8
record