Dynamically created methods in Ruby

, May 15, 2008

Ola Bini on when to use def, define_method, inside our outside of eval:

Defining methods can be complicated in Ruby, and you absolutely need to know when to use which one of these variations. Try to avoid define_method unless you absolutely have to, and remember that def is available in more places than you might think.