Sha256: 0addbae5167afbd6d494a542e0e390fe302082f057c1ea9d7d86d3b949b6a08b

Contents?: true

Size: 538 Bytes

Versions: 6

Compression:

Stored size: 538 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

6 entries across 6 versions & 1 rubygems

Version Path
ruby-next-core-0.10.5 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.10.4 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.10.3 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.10.2 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.10.1 lib/ruby-next/core/hash/deconstruct_keys.rb
ruby-next-core-0.10.0 lib/ruby-next/core/hash/deconstruct_keys.rb