This points to both
map calling the
enum_collect function in the underlying c code.
I wanted to dig one step further and see where and how
collect get defined to call this
enum_collect function is defined in the
enum.c class. In the very bottom of this class is where we can find how these two methods are bound to the
rb_define_method(rb_mEnumerable, "collect", enum_collect, 0); rb_define_method(rb_mEnumerable, "map", enum_collect, 0);
So we can say with certainty
collect can be used interchangeably with no differences in implementation or speed.
Now why these both exist and not just one is speculated on, but no real official answer.