Skip to content

Commit 3100f65

Browse files
authoredJan 26, 2019
Merge pull request #663 from maschwenk/dont-mutate-options
[BUG] Don't mutate passed configuration options
2 parents 92a7b3a + fc52d9c commit 3100f65

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎ext/redcarpet/rc_markdown.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ static VALUE rb_redcarpet_md__new(int argc, VALUE *argv, VALUE klass)
115115

116116
/* Merge the current options in the @options hash */
117117
if (hash != Qnil) {
118-
rndr_options = rb_iv_get(rb_rndr, "@options");
119-
rb_funcall(rndr_options, rb_intern("merge!"), 1, hash);
118+
rndr_options = rb_funcall(rb_iv_get(rb_rndr, "@options"), rb_intern("merge"), 1, hash);
119+
rb_iv_set(rb_rndr, "@options", rndr_options);
120120
}
121121

122122
markdown = sd_markdown_new(extensions, 16, &rndr->callbacks, &rndr->options);

‎test/custom_render_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_simple_overload
2323
end
2424

2525
def test_renderer_options
26-
parser = Redcarpet::Markdown.new(SimpleRender.new(with_toc_data: true))
26+
parser = Redcarpet::Markdown.new(SimpleRender.new({ with_toc_data: true }.freeze), {})
2727
output = parser.render("# A title")
2828

2929
assert_match "My little poney", output

0 commit comments

Comments
 (0)
Please sign in to comment.