Ruby ( with Typhoeus )
def Users.store(response)
@responses << response
end
users = Users.new
request1 = Typhoeus::Request.new(‘/user1.json’)
request2 = Typhoeus::Request.new(‘/user2.json’)
request1.on_complete(users.store)
request2.on_complete(users.store)
hydra.queue request1
hydra.queue request2
hydra.run
#=> ArgumentError:
wrong number of arguments (0 for 1)
Ruby ( with Typhoeus )
request.on_complete(users.store)
#=> Users#store
#=> ArgumentError:
wrong number of arguments (0 for 1)
Ruby ( with Typhoeus )
def Users.store(response)
@responses << response
end
users = Users.new
request.on_complete do |response|
users.store(response)
end #=> OK
Ruby ( with Typhoeus )
def Users.store(response)
@responses << response
end
users = Users.new
request.on_complete &users.method(:store)
#=> OK
request.on_complete = users.method(:store)
#=> OK (only for Typhoeus::Request)