Improve middleware performance

Use `Proc` objects in the different middlewares to set `:request` and `:context` data.

These objects are called when the payload is being prepared, in the same way that `data[:person]`.
The main difference between lamdas and procs, depending on the ruby
version, is the behaviour of using 'return' inside the block. I think in
this case is not relevant.

Good catch anyway.
On 9 Dec 2014 20:32, "coryvirok" <notifications@github.com> wrote:

> In lib/rollbar/middleware/rails/rollbar.rb
> <https://github.com/rollbar/rollbar-gem/pull/194#discussion-diff-21555306>
> :
>
> >            {
> > -            :request => request_data,
> > +            :request => proc { request_data(env) },
>
> I've been reading a bit about Procs vs Lambdas in Ruby.
>
> I'm not sure this is relevant but wanted to make sure you were aware:
>
>
> http://www.skorks.com/2010/05/ruby-procs-and-lambdas-and-the-difference-between-them/
>
> Using the proc method in the Kernel module. Being in the Kernel module, this method is globally available. It is basically equivalent to Proc.new in Ruby 1.9, but not in Ruby 1.8. In Ruby 1.8 the proc method is equivalent to lambda.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/rollbar/rollbar-gem/pull/194/files#r21555306>.
>