Re:Why Ruby is an acceptable Lisp (2005)
by RangerScience on Saturday September 10, 2016 @05:02PM
(#12470861)
The poingant guide link (implimentation of the "belongs_to" class function) is a string of redirects. Anyone have a copy of the original?
[ Parent
| on HN ]
Re:Why Ruby is an acceptable Lisp (2005)
by pdkl95 on Saturday September 10, 2016 @05:03PM
(#12470866)
http://poignant.guide/book/chapter-6.html#section3
edit:
While I love _why's guide, which can be very useful for learning ruby metaprogramming (and ruby in general), the technique presented there is a bit outdated. Modern ruby doesn't require such an "ugly" style because we now have Object#define_singleton_method[1] as a way of defining class level methods. There shouldn't be a need to use #instance_eval to define methods in the metaclass.
[1] https://ruby-doc.org/core-2.2.2/Object.html#method-i-define_...