3 ms·
from a reddit comment: "Glad we'll have a built-in struct class that's not Enumerable. I remember passing a Struct instance to a method which had a check for o
by weaksauce 4y ago
from a reddit comment:
"Glad we'll have a built-in struct class that's not Enumerable. I remember passing a Struct instance to a method which had a check for object.is_a?(Enumerable), and then proceeded to do something else than what I intended. It's fine to offer a way to iterate over attributes, but it was unnecessary to make the whole Struct Enumerable."
- Lammy 4y agoThis is the use-case for me. Here's an actual example of a Struct I will probably convert to Data in the file-identification library I've been working on. Right now they just have their `#to_a` overridden to disable some of their annoying automatic Enumerable behavior: https://github.com/okeeblow/DistorteD/blob/dd2a99285072982d32e69a2e63d204b0d4aff262/CHECKING%20YOU%20OUT/lib/checking-you-out/inner_spirit.rb#L82-L91 https://github.com/okeeblow/DistorteD/blob/dd2a99285072982d3...