Tag Archives: arrays

Array Set Operations in Ruby

Sometimes you want to treat an Array like a set. Continue reading

Posted in Ruby | Tagged , , , | 14 Comments

Treating Arrays as Sets

Reading through the Rake source code the other day (a pastime I highly recommend), I was reminded of a technique I don’t use often enough: my_array = [:foo, :bar, :baz] my_array |= [:baz, :buz] # => [:foo, :bar, :baz, :buz] … Continue reading

Posted in Howto, Ruby | Tagged , | 1 Comment