Use define_method instead of method_missing

Review 1168 by @mlucy
Closes #1896