Method: Array#merge
- Defined in:
- lib/jinx/helpers/merge.rb
#merge(other) ⇒ Object
Adds the elements in the other Enumerable which are not already included in this Array. Returns this modified Array.
53 54 55 56 57 58 59 |
# File 'lib/jinx/helpers/merge.rb', line 53 def merge(other) # incompatible merge argument is allowed but ignored self unless Enumerable === other # concatenate the members of other not in self unique = other.to_a - self concat(unique) end |