Sha256: a20ce371a1502d16f34ed9b1ef5312962c74838e27dc81f298ec61d91d96fde1

Contents?: true

Size: 574 Bytes

Versions: 14

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

RubyNext::Core.patch Hash, method: :deconstruct_keys, version: "2.7" do
  <<~RUBY
    def deconstruct_keys(_)
      self
    end
  RUBY
end

# We need to hack `respond_to?` in Ruby 2.5, since it's not working with refinements
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
  RubyNext::Core.patch refineable: Hash, name: "HashRespondToDeconstructKeys", method: :deconstruct_keys, version: "2.7" do
    <<~RUBY
      def respond_to?(mid, *)
        return true if mid == :deconstruct_keys
        super
      end
    RUBY
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
ruby-next-core-0.9.2 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.9.1 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.9.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.9.0.pre lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.8.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.7.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.6.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.5.3 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.5.2 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.5.1 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.5.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.4.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-0.3.0 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.3.0 lib/ruby-next/core/hash/deconstruct_keys.rb