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.
This commit is contained in:
Akira Matsuda 2017-10-22 01:42:02 +09:00
parent 20c9111990
commit 20df3f7786
1 changed files with 1 additions and 2 deletions

View File

@ -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