Sha256: 5b935701dbb5cea78d0bfd12047d282801d9045388fe498ddd814b386153b9e8

Contents?: true

Size: 334 Bytes

Versions: 29

Compression:

Stored size: 334 Bytes

Contents

class Array
  # Returns true if the two arrays elements are equal ignoring order
  # Example:
  #  [1,2].equivalent([2,1])    # => true
  #  [1,2,3].equivalent([2,1])  # => false
  def equivalent?(other_array)
    merged_array = self & other_array
    merged_array.size == self.size && merged_array.size == other_array.size
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
taza-0.9.1.1 lib/extensions/array.rb
taza-0.9.1 lib/extensions/array.rb
taza-0.9.0 lib/extensions/array.rb
taza-0.8.5 lib/extensions/array.rb
taza-0.8.4 lib/extensions/array.rb
taza-0.8.3 lib/extensions/array.rb
taza-0.8.2 lib/extensions/array.rb
taza-0.8.7 lib/extensions/array.rb
taza-0.8.6 lib/extensions/array.rb