virtus icon indicating copy to clipboard operation
virtus copied to clipboard

AttributeSet#select should return another AttributeSet

Open postmodern opened this issue 11 years ago • 3 comments
trafficstars

Shouldn't AttributeSet#select return a sub-attribute-set?

postmodern avatar Aug 09 '14 00:08 postmodern

It's an enumerable that yields attribute instances so default behavior is that you end up with an array. If there's a simple way of making it return an attribute set instance then I'm all for it.

solnic avatar Sep 11 '14 10:09 solnic

You would have to override #select to wrap the result in a new AttributeSet. While it would be nice to retain the methods in AttributeSet, #select traditionally returns an Array (even for Hash and Set).

postmodern avatar Sep 11 '14 18:09 postmodern

@postmodern At least as of Ruby 1.9.3, Hash#select returns a Hash. I know that this was not the case in Ruby 1.8.7 where it did return an Array.

jgdreyes avatar Nov 27 '14 00:11 jgdreyes