Flowdock
define_method_attribute(attr_name) protected

We want to generate the methods via module_eval rather than define_method, because define_method is slower on dispatch and uses more memory (because it creates a closure).

But sometimes the database might return columns with characters that are not allowed in normal method names (like ‘my_column(omg)’. So to work around this we first define with the __temp__ identifier, and then use alias method to rename it to what we want.

Show source
Register or log in to add new notes.