Skip to content

Commit 3c336a2

Browse files
hsbtjeremyevans
andcommitted
Support the keyword separation feature on Ruby 2.7
backport from rubygems/bundler@da7e1f5 Co-authored-by: Jeremy Evans <[email protected]>
1 parent 44a75a9 commit 3c336a2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/thor.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ def long_desc(long_description, options = {})
9090
# ==== Parameters
9191
# Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command.
9292
#
93-
def map(mappings = nil)
93+
def map(mappings = nil, **kw)
9494
@map ||= from_superclass(:map, {})
9595

96+
if mappings && !kw.empty?
97+
mappings = kw.merge!(mappings)
98+
else
99+
mappings ||= kw
100+
end
96101
if mappings
97102
mappings.each do |key, value|
98103
if key.respond_to?(:each)

0 commit comments

Comments
 (0)