From c9aa7acfc66a745ffd494caa3f32164cfe596346 Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Sun, 3 Dec 2023 13:08:17 -0800 Subject: [PATCH] save type doesn't need to check with a regular expression --- src/crab/gba/storage.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crab/gba/storage.cr b/src/crab/gba/storage.cr index 1f44de4..9d68211 100644 --- a/src/crab/gba/storage.cr +++ b/src/crab/gba/storage.cr @@ -7,8 +7,8 @@ module GBA FLASH512 FLASH1M - def regex : Regex # don't rely on the 3 digits after this string - /#{self}_V/ + def match_str : String # don't rely on the 3 digits after this string + "#{self}_V" end def bytes : Int @@ -67,7 +67,7 @@ module GBA private def self.find_type(file : File) : Type? str = file.gets_to_end - Type.each { |type| return type if type.regex.matches?(str) } + Type.each { |type| return type if str.includes?(type.match_str) } end end end