Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace 'name_table.fetch(i) { i }' with 'name_table.fetch(i, i)'
  • Loading branch information
makenowjust authored and asterite committed Sep 11, 2017
1 parent 325288a commit acc40a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/regex/match_data.cr
Expand Up @@ -282,7 +282,7 @@ class Regex

hash = {} of (String | Int32) => String?
(0...size).each do |i|
hash[name_table.fetch(i) { i }] = self[i]?
hash[name_table.fetch(i, i)] = self[i]?
end

hash
Expand All @@ -298,7 +298,7 @@ class Regex
io << "#<Regex::MatchData"
size.times do |i|
io << " "
io << name_table.fetch(i) { i } << ":" if i > 0
io << name_table.fetch(i, i) << ":" if i > 0
self[i]?.inspect(io)
end
io << ">"
Expand All @@ -314,7 +314,7 @@ class Regex
if i == 0
self[i].pretty_print pp
else
pp.text "#{name_table.fetch(i) { i }}:"
pp.text "#{name_table.fetch(i, i)}:"
pp.nest do
pp.breakable ""
self[i].pretty_print pp
Expand Down

0 comments on commit acc40a0

Please sign in to comment.