Sha256: 86ff76aa92fac62c5134bb350528729d2ddb3ddcd3e8f7bef5f8fc140b2e49dc

Contents?: true

Size: 554 Bytes

Versions: 25

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

RubyNext::Core.patch Array, method: :union, version: "2.6" do
  <<-RUBY
def union(*others)
  others.reduce(Array.new(self).uniq) { |acc, arr| acc | arr }
end
  RUBY
end

RubyNext::Core.patch Array, method: :difference, version: "2.6" do
  <<-RUBY
def difference(*others)
  others.reduce(Array.new(self)) { |acc, arr| acc - arr }
end
  RUBY
end

RubyNext::Core.patch Array, method: :intersection, version: "2.7" do
  <<-RUBY
def intersection(*others)
  others.reduce(Array.new(self)) { |acc, arr| acc & arr }
end
  RUBY
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ruby-next-core-1.1.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-1.0.3 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-1.0.2 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-1.0.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-1.0.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-1.0.0.rc.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.15.3 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.15.2 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.15.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.15.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.14.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.14.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.13.3 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.13.2 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.13.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.13.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.12.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.11.1 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.11.0 lib/ruby-next/core/array/difference_union_intersection.rb
ruby-next-core-0.10.5 lib/ruby-next/core/array/difference_union_intersection.rb