From 0bb424c2dfb41633a9d6e4eb5b2435a3b01ea7f8 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 17 Dec 2021 14:59:21 -0800 Subject: [PATCH] Remove with_info method which is isolated to the module --- plugins/commands/serve/service.rb | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/plugins/commands/serve/service.rb b/plugins/commands/serve/service.rb index cd37a53a0..1ffdfedb0 100644 --- a/plugins/commands/serve/service.rb +++ b/plugins/commands/serve/service.rb @@ -1,3 +1,5 @@ +require "ostruct" + module VagrantPlugins module CommandServe module Service @@ -10,13 +12,12 @@ module VagrantPlugins autoload :ProviderService, Vagrant.source_root.join("plugins/commands/serve/service/provider_service").to_s autoload :SyncedFolderService, Vagrant.source_root.join("plugins/commands/serve/service/synced_folder_service").to_s + class ServiceInfo < OpenStruct - class ServiceInfo - # @return [String] Name of requested plugin - attr_reader :plugin_name - - def initialize(plugin_name: nil) - @plugin_name = plugin_name + def initialize(plugin_name: nil, broker: nil) + super() + self.plugin_name = plugin_name.to_sym if plugin_name + self.broker = broker end def self.info @@ -28,15 +29,8 @@ module VagrantPlugins info end - def self.with_info(context) - info = new(plugin_name: context.metadata["plugin_name"]) - Thread.current.thread_variable_set(:service_info, info) - return if !block_given? - begin - yield info - ensure - Thread.current.thread_variable_set(:service_info, nil) - end + def self.with_info(context, broker: nil) + raise NotImplementedError end end end