问题
In a gem I'm writing I am trying to add the rack methods params, session, and env to Object so that they can be accessed and modified by the user of the gem. I have tried using Object.instance_variable_set and Object.instance_variable_get to add the variables to Object and then set them again by retrieving them from Object. I have been using the Rack::Request.new(env) interface to do this. The only problem is that it seems to be impossible to set params and session through this object. This has led be to believe that I am doing something very wrong. How can I set params and session through Rack::Request? Please also let me know if what I'm doing is bad practice or if there is a better way of doing it.
来源:https://stackoverflow.com/questions/38675366/adding-params-and-session-and-env-to-object