isolate core HostsFile module code into its own class

This commit is contained in:
Paulo Bittencourt 2014-04-27 12:50:39 -04:00
parent d60018ad1d
commit 22af89a8de
1 changed files with 190 additions and 172 deletions

View File

@ -3,6 +3,23 @@ require 'tempfile'
module VagrantPlugins
module HostManager
module HostsFile
def update_guest(machine)
Updater.new(@global_env, @config, @provider).update_guest(machine)
end
def update_host
Updater.new(@global_env, @config, @provider).update_host
end
class Updater
def initialize(global_env, config, provider)
@global_env = global_env
@config = config
@provider = provider
end
def update_guest(machine)
return unless machine.communicate.ready?
@ -192,4 +209,5 @@ module VagrantPlugins
end
end
end
end
end