Pergunta

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 exception (at line 7):

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

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)

Foi útil?

Solução

Sorry people, I should have looked harder before posting here...

Fixed it:

Just inserted the line require 'stringio' to give this:

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

It looks like stringio is assumed to be loaded - but isn't loaded explicitly by ruby-mbox...

Oddly, the example scripts don't load it either...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top