From a25ea2af08445f42d7a6f1f6fcd1ca350bf2e63f Mon Sep 17 00:00:00 2001 From: Stephen Reay Date: Thu, 29 Jun 2023 23:44:24 +0700 Subject: [PATCH] Use keyword argument in place of a hash for I18n.t() calls Fixes devopsgroup-io/vagrant-hostmanager#290 --- lib/vagrant-hostmanager/action/update_guest.rb | 4 +--- lib/vagrant-hostmanager/config.rb | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/vagrant-hostmanager/action/update_guest.rb b/lib/vagrant-hostmanager/action/update_guest.rb index a957608..9824dc8 100644 --- a/lib/vagrant-hostmanager/action/update_guest.rb +++ b/lib/vagrant-hostmanager/action/update_guest.rb @@ -17,9 +17,7 @@ def initialize(app, env) def call(env) if @config.hostmanager.manage_guest? - env[:ui].info I18n.t('vagrant_hostmanager.action.update_guest', { - :name => @machine.name - }) + env[:ui].info I18n.t('vagrant_hostmanager.action.update_guest', name: @machine.name) @updater.update_guest(@machine) @app.call(env) diff --git a/lib/vagrant-hostmanager/config.rb b/lib/vagrant-hostmanager/config.rb index 1ae26f4..305d681 100644 --- a/lib/vagrant-hostmanager/config.rb +++ b/lib/vagrant-hostmanager/config.rb @@ -49,7 +49,7 @@ def validate(machine) # check if aliases option is an Array if !machine.config.hostmanager.aliases.kind_of?(Array) && !machine.config.hostmanager.aliases.kind_of?(String) - errors << I18n.t('vagrant_hostmanager.config.not_an_array_or_string', { + errors << I18n.t('vagrant_hostmanager.config.not_an_array_or_string', **{ :config_key => 'hostmanager.aliases', :is_class => aliases.class.to_s, }) @@ -57,7 +57,7 @@ def validate(machine) if !machine.config.hostmanager.ip_resolver.nil? && !machine.config.hostmanager.ip_resolver.kind_of?(Proc) - errors << I18n.t('vagrant_hostmanager.config.not_a_proc', { + errors << I18n.t('vagrant_hostmanager.config.not_a_proc', **{ :config_key => 'hostmanager.ip_resolver', :is_class => ip_resolver.class.to_s, }) @@ -72,7 +72,7 @@ def validate(machine) def validate_bool(key, value) if ![TrueClass, FalseClass].include?(value.class) && value != UNSET_VALUE - I18n.t('vagrant_hostmanager.config.not_a_bool', { + I18n.t('vagrant_hostmanager.config.not_a_bool', **{ :config_key => key, :value => value.class.to_s })