Why doesn't this code using the ruby-mbox gem parse mbox files?

Posted by cartoonfox on Stack Overflow See other posts from Stack Overflow or by cartoonfox
Published on 2011-01-15T15:50:24Z Indexed on 2011/01/16 8:53 UTC
Read the original article Hit count: 296

Filed under:
|
|
|

I installed ruby-mbox by doing gem install ruby-mbox

Running this:

#!/usr/bin/ruby
require 'rubygems'
require 'mbox'
m = IO.read('test.eml')
puts m.size
m = Mbox.new(m)
puts m

produces this:

71309505
/Library/Ruby/Gems/1.8/gems/ruby-mbox-0.0.2/lib/mbox/mbox.rb:45:in `initialize': uninitialized constant Mbox::StringIO (NameError)
    from r.rb:7:in `new'
    from r.rb:7

I have proved that "m" is assigned a string containing the contents of the file, just before Mbox.new(m) is called.

It looks as though the Mbox::StringIO should have been defined by hasn't been.

What's going wrong here?

Ruby version:

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

(That's the default ruby installed on OS X 10.6.6)

© Stack Overflow or respective owner

Related posts about ruby

Related posts about email