From 399cc9c2205fed2ebdd7b82a5ffe5d9fbe97f4cd Mon Sep 17 00:00:00 2001 From: KC Maddever Date: Tue, 31 Aug 2021 14:43:21 +0800 Subject: [PATCH] DEV: rubocop --- ...10806135416_split_custom_wizard_log_fields.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/db/migrate/20210806135416_split_custom_wizard_log_fields.rb b/db/migrate/20210806135416_split_custom_wizard_log_fields.rb index 2e7b7d21..984a7a23 100644 --- a/db/migrate/20210806135416_split_custom_wizard_log_fields.rb +++ b/db/migrate/20210806135416_split_custom_wizard_log_fields.rb @@ -1,11 +1,12 @@ +# frozen_string_literal: true class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1] def change reversible do |dir| dir.up do - # separate wizard/action/user into their own keys + # separate wizard/action/user into their own keys - wizard_logs = PluginStoreRow.where(" - plugin_name = 'custom_wizard_log' + wizard_logs = PluginStoreRow.where(" + plugin_name = 'custom_wizard_log' ") if wizard_logs.exists? @@ -16,8 +17,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1] next end - - if log_json.key?('message') and log_json['message'].is_a? String + if log_json.key?('message') && log_json['message'].is_a?(String) attr_strs = [] @@ -28,7 +28,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1] attr_strs.each do |attr_str| if attr_str.is_a? String - attr_str.gsub!(/[;]/ ,"") + attr_str.gsub!(/[;]/ , "") key, value = attr_str.split(': ') value.strip! if value log_json[key] = value ? value : '' @@ -44,7 +44,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1] end dir.down do wizard_logs = PluginStoreRow.where(" - plugin_name = 'custom_wizard_log' + plugin_name = 'custom_wizard_log' ") if wizard_logs.exists? @@ -58,7 +58,7 @@ class SplitCustomWizardLogFields < ActiveRecord::Migration[6.1] # concatenate wizard/action/user to start of message prefixes = log_json.extract!('wizard', 'action', 'user') - message_prefix = prefixes.map{|k,v| "#{k}: #{v}"}.join('; ') + message_prefix = prefixes.map { |k, v| "#{k}: #{v}" }.join('; ') if log_json.key?('message') log_json['message'] = "#{message_prefix}; #{log_json['message']}"