save type doesn't need to check with a regular expression

This commit is contained in:
Matthew Berry 2023-12-03 13:08:17 -08:00
parent 19113be832
commit c9aa7acfc6

View file

@ -7,8 +7,8 @@ module GBA
FLASH512 FLASH512
FLASH1M FLASH1M
def regex : Regex # don't rely on the 3 digits after this string def match_str : String # don't rely on the 3 digits after this string
/#{self}_V/ "#{self}_V"
end end
def bytes : Int def bytes : Int
@ -67,7 +67,7 @@ module GBA
private def self.find_type(file : File) : Type? private def self.find_type(file : File) : Type?
str = file.gets_to_end 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 end
end end