From 19bbae5dd8c9ce908b45c53658b40a5c90e1d57f Mon Sep 17 00:00:00 2001 From: darthjee Date: Mon, 29 Jul 2024 16:01:40 -0300 Subject: [PATCH] Use to_h --- utils/font_helper/.rubocop_todo.yml | 6 ------ utils/font_helper/source/font_helper/font.rb | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/utils/font_helper/.rubocop_todo.yml b/utils/font_helper/.rubocop_todo.yml index ff02c38..de31eea 100644 --- a/utils/font_helper/.rubocop_todo.yml +++ b/utils/font_helper/.rubocop_todo.yml @@ -6,12 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/MapToHash: - Exclude: - - 'source/font_helper/font.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. diff --git a/utils/font_helper/source/font_helper/font.rb b/utils/font_helper/source/font_helper/font.rb index c6099b5..4b789a9 100644 --- a/utils/font_helper/source/font_helper/font.rb +++ b/utils/font_helper/source/font_helper/font.rb @@ -9,9 +9,9 @@ class FontHelper def initialize(width, height, characters = nil) @width = width @height = height - @characters = characters.map do |character| + @characters = characters.to_h do |character| [character.code, character] - end.to_h + end end def <<(character)