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-2.1.0 lib/extensions/array.rb
taza-2.0 lib/extensions/array.rb
taza-1.0 lib/extensions/array.rb
bret-watircraft-0.4.0 lib/extensions/array.rb
bret-watircraft-0.4.1 lib/extensions/array.rb
bret-watircraft-0.4.2 lib/extensions/array.rb
bret-watircraft-0.4.3 lib/extensions/array.rb
bret-watircraft-0.4.4 lib/extensions/array.rb
bret-watircraft-0.4.5 lib/extensions/array.rb
bret-watircraft-0.5.0 lib/extensions/array.rb
makevoid-taza-0.8.6 lib/extensions/array.rb
scudco-taza-0.8.1 lib/extensions/array.rb
scudco-taza-0.8.3 lib/extensions/array.rb
scudco-taza-0.8.4 lib/extensions/array.rb
scudco-taza-0.8.5 lib/extensions/array.rb
scudco-taza-0.8.6 lib/extensions/array.rb
scudco-taza-0.8.7 lib/extensions/array.rb
taza-0.9.2.1 lib/extensions/array.rb
taza-0.9.2.0 lib/extensions/array.rb
taza-0.9.1.2 lib/extensions/array.rb