diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-10-22 01:42:02 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-10-22 01:53:11 +0900 |
commit | 20df3f778649d50498a5c04b98abd2379f56b31c (patch) | |
tree | acd66cebbf7dbab1b5f4150eba7746d07ddb6030 | |
parent | 20c91119903f70eb19aed33fe78417789dbf070f (diff) | |
download | rails-20df3f778649d50498a5c04b98abd2379f56b31c.tar.gz rails-20df3f778649d50498a5c04b98abd2379f56b31c.tar.bz2 rails-20df3f778649d50498a5c04b98abd2379f56b31c.zip |
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.
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | 3 |
1 files changed, 1 insertions, 2 deletions
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 |