[Ruby] eql? and hash on Sets

John Barnette jbarnette at gmail.com
Sun Nov 25 16:51:01 PST 2007


On Nov 25, 2007 11:27 AM, Aaron Patterson <aaron at tenderlovemaking.com> wrote:
> I'm using them in CSSPool.  I need to keep track of properties for each
> rule.  Each rule has a selector and many properties.  I don't really
> care what order the properties are in, but I do care that they are
> unique.  So Set seemed appropriate.  Then I wanted to reduce my CSS, and
> group all rules by property.  So if many rules had the same properties,
> I could reduce the size of the CSS.

Given two sets, (first - second).empty? is probably going to be the
best way to test for equality.


~ j.


More information about the Ruby mailing list