Skip to content
Permalink
Browse files
MatchData: refactor to_s
  • Loading branch information
makenowjust authored and asterite committed Sep 10, 2017
1 parent 203ab9f commit 7369daa8f2ff55f41dedeec992174645017e6889
Showing with 4 additions and 8 deletions.
  1. +4 −8 src/regex/match_data.cr
@@ -295,15 +295,11 @@ class Regex
def to_s(io : IO)
name_table = @regex.name_table

io << "#<Regex::MatchData "
self[0].inspect(io)
if size > 1
io << "#<Regex::MatchData"
size.times do |i|
io << " "
(1...size).join " ", io do |i|
io << name_table.fetch(i) { i }
io << ":"
self[i]?.inspect(io)
end
io << name_table.fetch(i) { i } << ":" if i > 0
self[i]?.inspect(io)
end
io << ">"
end

0 comments on commit 7369daa

Please sign in to comment.