Replacing Eval with Object.send and a self written Parser · Ramblings of a build engineer
02-Jun-2017 2792
A while ago, I was added as a curator for a Gem called JsonPath. It’s a small but very useful and brilliant gem. It had a couple of problems which I fixed, but the hardest to eliminate proved to be a series of evals throughout the code.You could opt in using eval with a constructor parameter, but generally, it was considered to be unsafe. Thus, normally when a project was using it, like Huginn they had to opt out by default, thus missing out on sweet parsing like this: $..book[?(@['price'] > 20)].
Replacing Eval with Object.send and a self written Parser · Ramblings of a build engineer #ruby #rubydeveloper #rubyonrails #Replacing #Object.send #written #Parser #Ramblings #build #engineer #engineer https://rubyonrails.ba/link/replacing-eval-with-object-send-and-a-self-written-parser-ramblings-of-a-build-engineer