From 20df3f778649d50498a5c04b98abd2379f56b31c Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 22 Oct 2017 01:42:02 +0900 Subject: Avoid slicing from Thor's original HWIA Because `options` here is not AS::HWIA but an instance of Thor::CoreExt::HWIA that looks very similar to ours but behaves slightly different, we need to keep this object be an instance of Thor::CoreExt::HWIA. Since Ruby 2.5 has Hash#slice that returns a new Hash instance now, we need to avoid calling `slice` on this tricky object. --- railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'railties/lib/rails/generators') diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index d0dfb04162..331e73d1f0 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/hash/slice" require "rails/generators/rails/app/app_generator" require "date" @@ -93,7 +92,7 @@ task default: :test ] def generate_test_dummy(force = false) - opts = (options || {}).slice(*PASSTHROUGH_OPTIONS) + opts = (options.dup || {}).keep_if {|k, | PASSTHROUGH_OPTIONS.map(&:to_s).include?(k) } opts[:force] = force opts[:skip_bundle] = true opts[:skip_listen] = true -- cgit v1.2.3