Skip to content

Commit

Permalink
save type doesn't need to check with a regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrberry committed Dec 3, 2023
1 parent 19113be commit c9aa7ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/crab/gba/storage.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit c9aa7ac

Please sign in to comment.