by lucaspiller · 14y ago · 0 comments
If you return a Hash of attributes everyone knows how a Hash works, but if you return a custom Attributes object people have to learn how it works, there could be bugs, etc.
oh and since it's an enumerable it's easy to work with it just like with a hash.
I'm also not saying you should never ever use primitive objects because that would be silly :) The trick is to determine when it is better to use a custom class instead of misusing existing primitive ones. Hash is a good example in Ruby, people use it way too often.