3 ms·
Especially with pry existing now, the "Rails is magic" meme is tired and incorrect. Install pry, pry-rails. Something weird occurs? binding.pry, `show-method`
by evilduck 11y ago
Especially with pry existing now, the "Rails is magic" meme is tired and incorrect.
Install pry, pry-rails. Something weird occurs? binding.pry, `show-method` or `show-source` and it dumps you to the exact line and filepath of the method, be it the original or a monkeypatched method (use -a to show them). Keep digging like that and you'll eventually hit the C implementation code.
[18] pry(String):1> show-method length
From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 5
VALUE
rb_str_length(VALUE str)
{
return LONG2NUM(str_strlen(str, NULL));
}
- rudolf0 11y agoI wish other REPLs were like this. IPython does it too, but not sure others can.