Re:The Rails Doctrine
by weaksauce on Saturday May 13, 2023 @03:19PM
(#35931742)
Eloquent Ruby is a simply fantastic book that should be required reading for everyone. and yeah inheriting someone else's codebase that has a gem that installs some new dsl that you have no idea where it came from can be a nightmare.
[ Parent
| on HN ]
If you’re ever curious about where a method comes from, you can use method(:some_new_dsl).source_location [0].
[0]: https://docs.ruby-lang.org/en/3.2/Method.html#method-i-sourc...
oh yeah i've definitely used that in the past. just saying you have to get the code to run to that point and it's just a pain to figure out what is going on sometimes. a lot of times it's easy enough by browsing the gem file. however things get more murky when you have some dynamically generated methods and it just tells you the thing was created by eval.