From 4e35028e3fc0ceb6e90949f9c0209f3011c7154a Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 6 Oct 2021 08:16:49 -0700 Subject: [PATCH] Some small mapper adjustments and loaders --- plugins/commands/serve/mappers.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/commands/serve/mappers.rb b/plugins/commands/serve/mappers.rb index b14156107..47c0a5d34 100644 --- a/plugins/commands/serve/mappers.rb +++ b/plugins/commands/serve/mappers.rb @@ -169,8 +169,8 @@ module VagrantPlugins # @param value [Object] Value to map # @param to [Class] Resultant type (optional) # @return [Object] - def map(value, to: nil) - args = known_arguments + [value] + def map(value, *args, to: nil) + args = [value] + args + known_arguments matched_mappers = mappers.find_all do |m| if m.satisfied_by?(*args) if to @@ -202,7 +202,7 @@ module VagrantPlugins # @return [Array, Object] def funcspec_map(spec) result = spec.args.map do |arg| - map(arg) + map(arg, self) end if result.size == 1 return result.first @@ -225,3 +225,6 @@ require Vagrant.source_root.join("plugins/commands/serve/mappers/terminal.rb").t require Vagrant.source_root.join("plugins/commands/serve/mappers/command.rb").to_s require Vagrant.source_root.join("plugins/commands/serve/mappers/capability.rb").to_s require Vagrant.source_root.join("plugins/commands/serve/mappers/state_bag.rb").to_s +require Vagrant.source_root.join("plugins/commands/serve/mappers/direct.rb").to_s +require Vagrant.source_root.join("plugins/commands/serve/mappers/known_types.rb").to_s +require Vagrant.source_root.join("plugins/commands/serve/mappers/wrappers.rb").to_s