Skip to content

Commit

Permalink
MatchData: refactor to_s
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust authored and asterite committed Sep 10, 2017
1 parent 203ab9f commit 7369daa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/regex/match_data.cr
Expand Up @@ -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
Expand Down

0 comments on commit 7369daa

Please sign in to comment.