Thursday, January 23, 2014

Ruby: eval, define_method, send

eval, define_method, send

http://rubymonk.com/learning/books/5-metaprogramming-ruby-ascent/chapters/24-eval/lessons/63-eval#solution3816
eval should best be avoided in real scenarios. Ruby has saner tools (#define_method#send) in its meta-programming repertoire that you can use to achieve eval-like cleverness.

No comments:

Post a Comment

Followers

Blog Archive