Ruby-marc sages,
What's the best way to re-sequence fields in a record after appending to it? This seems to work ok, but feels wrong.
for record in reader
# Return a record with new field appended.
newrecord = add_control_number(record)
### Re-sort fields by tag and copy them to a new record. ###
sortedrecord = MARC::Record.new
sortedrecord.leader = newrecord.leader
newrecord.sort_by{|f| f.tag}.each {|tag| sortedrecord.append(tag)}
writer.write(sortedrecord)
end
Thanks,
Jason
Jason Stirnaman
Lead, Library Technology Services
University of Kansas Medical Center
[log in to unmask]
913-588-7319
|