[CODE4LIB] Unexpected ruby-marc behavior

2011-01-27 Thread Cory Rockliff
So I was taking ruby-marc out for a spin in irb, and encountered a bit of a surprise. Running the following: require 'marc' reader = MARC::Reader.new('filename.mrc') reader.each {|record| puts record['245']} produces the expected result, but every subsequent call to reader.each {|record| puts

Re: [CODE4LIB] Unexpected ruby-marc behavior

2011-01-27 Thread Ross Singer
No, that's expected behavior (and how it's always been). You'd need to do reader.rewind to put your enumerator cursor back to 0 to run back over the records. It's basically an IO object (since that's what it expects as input) and behaves like one. -Ross. On Thu, Jan 27, 2011 at 2:03 PM, Cory

Re: [CODE4LIB] Unexpected ruby-marc behavior

2011-01-27 Thread Cory Rockliff
Oh, gotcha. Thanks. C On Jan 27, 2011, at 2:11 PM, Ross Singer wrote: No, that's expected behavior (and how it's always been). You'd need to do reader.rewind to put your enumerator cursor back to 0 to run back over the records. It's basically an IO object (since that's what it expects as