p()
is an instance method of the Kernel
class see here. It is used for printing (like puts
does) but it calls the inspect
method on the argument. It is useful for debugging because you can see exactly what the value is because with puts the integer 1 will be printed as "1"
which is not what it is.
Every Rack application must respond to a method called call
that accepts the environment env
and returns an array of the form
[http_code, headers, body]
On the example above you can see that the App
object is a lambda
accepting the env
and returning an array of the aforementioned form. Thus it is a Rack application given that a lambda
has a method call
.
The rack_response
method does nothing more than returning a rack compatible array as you can see HERE.
More about Rack applications HERE.