Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enumerator should be supported by ActiveSupport::SafeBuffer #37494

Merged
merged 1 commit into from Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -297,6 +297,8 @@ def html_escape_interpolated_argument(arg)

def set_block_back_references(block, match_data)
block.binding.eval("proc { |m| $~ = m }").call(match_data)
rescue ArgumentError
# Can't create binding from C level Proc
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions activesupport/test/safe_buffer_test.rb
Expand Up @@ -274,4 +274,9 @@ def test_titleize
assert_equal "123foo 456bar", b
assert_not_predicate b, :html_safe?
end

test "Should support Enumerator" do
a = "aaa".html_safe.gsub!(/a/).with_index { |m, i| i }
assert_equal "012", a
end
end