DEV Community

Discussion on: Metaprogramming in ruby

Collapse
 
just-the-v profile image
Just The V

Hi Cherry ! I love to metaprogram in Ruby. This is something very satisfying ahah

I never thought of override life cycles methods, thanks a lot for this!
The best way i used metaprogramming was to dynamically declare methods in my controller to use turbo. When you have 10 different methods that always do the same things, it's really reduce the controller LoC!

Collapse
 
cherryramatis profile image
Cherry Ramatis

It's a pleasure to share knowledge with the community ❤️ thanks <3

I used the hook pattern once to control observability on some specific objects, that way I could send interesting information upon object creation. Metaprogramming is both a very dangerous and beautiful feature of ruby!