Eventmachine callback

Hi,

I am trying to use eventmachine last days, I used it for http request
with success but now I am trying to use it for a callback for some
normal method but I am getting error: undefined method `callback’ for
nil:NilClass

code:

class Myclass
include EM::Deferrable

def method()
array = result of mysqlquery
succeed(array)
end
end

EM.run do
cl = Myclass.new.method()
cl.callback do |array|
puts array elements
end

end

rgds,

This error means the cl variable is nil. Therefore Myclass#method
doesn’t return what you expect it to. Look into it yourself, or
provide the entire code.

– Matma R.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs