compatibility fix for Ruby 2.1

The trick to use eval to set local variables in ruby 2.1 is not
valid anymore. However, Binding now has the necessary methods so
simply use them when they are available.