Compare the following, both from Ruby 2.0:
b = Math.__send__(:binding)
b.eval("self")
=> main
b = Math.instance_eval { binding }
b.eval("self")
=> Math
# or equivalently...
b = Math.instance_eval("binding")
b.eval("self")
=> Math
The documentation for Kernel#binding
says it "describes the variable and method bindings at the point of call". I think that accurately describes the behavior you are seeing with Math.__send__(:binding)
. The Binding object you get back retains the value of self
at the point of call.