Skip to content

Commit 7116b5a

Browse files
committed
don't repeatedly reallocate strings while parsing arg_ids
1 parent f3a40d0 commit 7116b5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/message_format/parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def parse_argument ()
179179

180180
def parse_arg_id ()
181181
skip_whitespace()
182-
id = ''
182+
id = +''
183183
while @index < @length
184184
char = @pattern[@index]
185185
if char == '{' or char == '#'
@@ -188,7 +188,7 @@ def parse_arg_id ()
188188
if char == '}' or char == ',' or is_whitespace(char)
189189
break
190190
end
191-
id += char
191+
id << char
192192
@index += 1
193193
end
194194
if id.empty?

0 commit comments

Comments
 (0)