binding.pry
| rubyI have a sudden realization I want to share. Today we inspect
binding.pry
.
Besides being a great debugger and tool for writing code, this method call is actually aptly named. Looking at the etymology, binding alone didn’t have the necessary context to have any significant meaning to me. Wasn’t until after I saw this word used in the blocks chapter of Metaprogramming Ruby did I realize how it was being used.
“Code that runs is actually made up of two things: the code itself and a set of bindings.” Okay, I see you binding, a.k.a the connection between a name and an object.
To pry into something is to go overboard into investigating
something. Ruby is a language that features objects and the ability to introspect the fuck
out of them. Hence, binding.pry
is clever all many levels. Well
played!