提交 9fadf385 编写于 作者: D Damien Mathieu

calling unsafe methods which don't return a string shouldn't fail

上级 0dd32e8e
......@@ -137,8 +137,8 @@ def to_yaml(*args)
UNSAFE_STRING_METHODS.each do |unsafe_method|
class_eval <<-EOT, __FILE__, __LINE__
def #{unsafe_method}(*args)
super.to_str
def #{unsafe_method}(*args, &block)
to_str.#{unsafe_method}(*args, &block)
end
def #{unsafe_method}!(*args)
......
......@@ -104,4 +104,8 @@ def setup
@buffer.safe_concat "BUSTED"
end
end
test "should not fail if the returned object is not a string" do
assert_kind_of Enumerator, @buffer.gsub(/.*/)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册