lib/marc_cleanup/bib_rubymarc_fixes.rb
### Replaces obsolete values with the current value;
#     if encoding level, cataloging form or multipart indicators
#     are outside accepted values, replace them with 'unknown'
#     normalize the indicator length and subfield code length to 2;
#     make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value;
if encoding level, cataloging form or multipart indicators
are outside accepted values, replace them with 'unknown'
normalize the indicator length and subfield code length to 2;
make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value ; if encoding level cataloging form or multipart indicators are outside accepted values replace them with ' unknown ' normalize the indicator length and subfield code length to 2 ; make the last 4 positions the only possible value of ' 4500 '
def fix_map_008(field)
    fixed_field = ''
    relief = field[0..3]
    proj = field[4..5]
    type = field[7]
    gov_pub = field[10]
    item_form = field[11]
    index_code = field[13]
    format = field[15..16]
    unless relief == '||||'
      relief.gsub!('h', 'c')
      relief_chars = relief.chars.select { |c| %w[a b c d e f g i j k m z ].include? c }.sort.join('')
      relief = relief_chars.ljust(4)
    end
    fixed_field << relief
    fixed_field << proj
    fixed_field << ' '
    fixed_field << type
    fixed_field << '  '
    gov_pub.gsub!('n', 'o')
    fixed_field << gov_pub
    fixed_field << item_form
    fixed_field << ' '
    fixed_field << index_code
    fixed_field << ' '
    unless format == '||'
      format_chars = format.chars.select { |c| %w[e j k l n o p r z].include? c }.sort.join('')
      format = format_chars.ljust(2)
    end
    fixed_field << format
    fixed_field.gsub('-', '|')
  end
def fix_map_008 ( field ) fixed_field = '' relief = field [ 0 .. 3 ] proj = field [ 4 .. 5 ] type = field [ 7 ] gov_pub = field [ 10 ] item_form = field [ 11 ] index_code = field [ 13 ] format = field [ 15 .. 16 ] unless relief == '||||' relief . gsub! ( 'h' , 'c' ) relief_chars = relief . chars . select { | c | %w[ a b c d e f g i j k m z ] . include? c } . sort . join ( '' ) relief = relief_chars . ljust ( 4 ) end fixed_field << relief fixed_field << proj fixed_field << ' ' fixed_field << type fixed_field << '  ' gov_pub . gsub! ( 'n' , 'o' ) fixed_field << gov_pub fixed_field << item_form fixed_field << ' ' fixed_field << index_code fixed_field << ' ' unless format == '||' format_chars = format . chars . select { | c | %w[ e j k l n o p r z ] . include? c } . sort . join ( '' ) format = format_chars . ljust ( 2 ) end fixed_field << format fixed_field . gsub ( '-' , '|' ) end
Replaces obsolete values with the current value;
if encoding level, cataloging form or multipart indicators
are outside accepted values, replace them with 'unknown'
normalize the indicator length and subfield code length to 2;
make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value ; if encoding level cataloging form or multipart indicators are outside accepted values replace them with ' unknown ' normalize the indicator length and subfield code length to 2 ; make the last 4 positions the only possible value of ' 4500 '
field