lib/marc_cleanup/bib_rubymarc_fixes.rb
def remove_field(field_string, record)
    orig_string = field_string.dup
    orig_string.scrub!('')
    orig_string.strip!
    field_tag = orig_string[0..2]
    target_fields = record.fields(field_tag)
    return record if target_fields.empty?
    target_fields.each do |field|
      string = field.to_s
      string.scrub!('')
      string.strip!
      next unless string == orig_string
      field_index = record.fields.index(field)
      record.fields.delete_at(field_index)
    end
    record
  end
### Remove field from a record that matches a string version of the field
###   generated by ruby-marc (ex.: '655  0 $a Electronic books')
Remove field from a record that matches a string version of the field
generated by ruby-marc (ex.: '655  0 $a Electronic books')
Remove field from a record that matches a string version of the field generated by ruby - marc ( ex . : ' 655 0 $a Electronic books ' )
def remove_field(field_string, record)
    orig_string = field_string.dup
    orig_string.scrub!('')
    orig_string.strip!
    field_tag = orig_string[0..2]
    target_fields = record.fields(field_tag)
    return record if target_fields.empty?
    target_fields.each do |field|
      string = field.to_s
      string.scrub!('')
      string.strip!
      next unless string == orig_string
      field_index = record.fields.index(field)
      record.fields.delete_at(field_index)
    end
    record
  end
def remove_field ( field_string , record ) orig_string = field_string . dup orig_string . scrub! ( '' ) orig_string . strip! field_tag = orig_string [ 0 .. 2 ] target_fields = record . fields ( field_tag ) return record if target_fields . empty? target_fields . each do | field | string = field . to_s string . scrub! ( '' ) string . strip! next unless string == orig_string field_index = record . fields . index ( field ) record . fields . delete_at ( field_index ) end record end
Remove field from a record that matches a string version of the field
generated by ruby-marc (ex.
Remove field from a record that matches a string version of the field generated by ruby - marc ( ex .
field_string
record