Mechanize: método indefinido 'información' para la clase Nil en Ruby 1.9.3

I'm trying to use the Ruby gem Mechanize in an app I'm building, but I'm getting an error.

Performing the following in IRB with Ruby 1.9.3-p0:

require 'Mechanize'
agent =
page = agent.get('')

Me da el siguiente error:

NoMethodError: undefined method `info' for nil:NilClass
from ~/.rvm/gems/ruby-1.9.3-p0@global/gems/net-http-spy-0.2.1/lib/net-http-spy.rb:24:in 'initialize'

The initialize block of net-http-spy.rb looks like this:

def initialize(*args, &block)
  self.class.http_logger_options ||= {}
  defaults =  {:body => false, :trace => false, :verbose => false, :limit => -1}
  self.class.http_logger_options = (self.class.http_logger_options == :default) ? defaults : self.class.http_logger_options
  @logger_options = defaults.merge(self.class.http_logger_options)
  @params_limit = @logger_options[:params_limit] || @logger_options[:limit]
  @body_limit   = @logger_options[:body_limit]   || @logger_options[:limit] "CONNECT: #{args.inspect}" if !@logger_options[:verbose]

  old_initialize(*args, &block)
  @debug_output   = self.class.http_logger if @logger_options[:verbose]

It appears to be the line starting which is causing problem, I'm just not sure why. Can anyone shed any light as to what I'm doing wrong?

preguntado el 30 de enero de 12 a las 19:01

This isn't really a Mechanize issue. I'd uninstall net-http-spy. There seems to be an incompatibility somewhere. If you want to record your Mechanize interactions, try Vídeo. -

Hmmm. Wondering if this is maybe down to RVM, as net-http-spy is in my global gemset, whereis Mechanize is in the project gemset. I tried un/reinstalling net-http-spy, but I'm still having the same issue. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.