Re:Rails – #forty_two() method
by briandear on Monday November 10, 2014 @04:13AM
(#8582645)
This was put in as a result of a folks complaining about .second and similar array sugar. I don't have the link to the Github thread from 8 years ago, but I remember it was prodigiously awesome.
Re:Rails – #forty_two() method
by ghayes on Monday November 10, 2014 @03:52PM
(#8586311)
For me, it comes up in test cases. In a controlled environment, it can be nice to mentally say "add two objects, the first should be this, the second should be this." I don't think I've ever used `second` outside of the testing realm.
https://github.com/rails/rails/blob/ed03d4eaa89a7b4ab09e7f5d...
Here's another interesting one from ActiveSupport giving Ruby Numerics the ability to be treated as various quantities of bytes:
https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f6...