8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05f5a0e commit ee99242Copy full SHA for ee99242
lib/coderay/encoders/html.rb
@@ -284,9 +284,8 @@ def style_for_kinds kinds
284
end
285
286
def make_span_for_kinds method, hint
287
- # FIXME: cache attack
288
Hash.new do |h, kinds|
289
- h[kinds] = begin
+ begin
290
css_class = css_class_for_kinds(kinds)
291
title = HTML.token_path_to_hint hint, kinds if hint
292
@@ -298,6 +297,9 @@ def make_span_for_kinds method, hint
298
297
"<span#{title}#{" class=\"#{css_class}\"" if css_class}>"
299
300
+ end.tap do |span|
301
+ h.clear if h.size >= 100
302
+ h[kinds] = span
303
304
305
0 commit comments