mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Fix ERB warning for Ruby 2.6+ in benchmark.rb
This commit is contained in:
parent
b2d6027c8a
commit
3a133efc13
1 changed files with 5 additions and 1 deletions
|
@ -38,7 +38,11 @@ RBench.run(times) do
|
|||
obj = Object.new
|
||||
|
||||
Haml::Engine.new(haml_template).def_method(obj, :haml)
|
||||
obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end")
|
||||
if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
||||
obj.instance_eval("def erb; #{ERB.new(erb_template, trim_mode: '-').src}; end")
|
||||
else
|
||||
obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end")
|
||||
end
|
||||
obj.instance_eval("def erubi; #{Erubi::Engine.new(erb_template).src}; end")
|
||||
|
||||
haml { obj.haml }
|
||||
|
|
Loading…
Add table
Reference in a new issue