File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ def ruby(*ruby_version)
4343 def normalize_ruby_file ( filename )
4444 file_content = Bundler . read_file ( gemfile . dirname . join ( filename ) )
4545 # match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46- if /^ruby[\s -]*(?:=\s *)?"?([^\s #"]+)"?/ . match ( file_content )
46+ if /^ # Start of line
47+ ruby # Literal "ruby"
48+ [\s -]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
49+ (?:=\s *)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50+ "? # Optional opening quote
51+ ( # Start capturing group
52+ [^\s #"]+ # One or more chars that aren't spaces, #, or quotes
53+ ) # End capturing group
54+ "? # Optional closing quote
55+ /x . match ( file_content )
4756 $1
4857 else
4958 file_content . strip
You can’t perform that action at this time.
0 commit comments