提交 b2b2f70f 编写于 作者: L localhostdotdev

Fix arity warning for template handlers

Mainly to help with knowning which template is reponsible for the
warning.

handler.class # => Class

handler.to_s # => Coffee::Rails::TemplateHandler

Before:

Change:
  >> Class#call(template)
To:
  >> Class#call(template, source)

After:

Change:
  >> Coffee::Rails::TemplateHandler.call(template)
To:
  >> Coffee::Rails::TemplateHandler.call(template, source)
上级 dc45130c
......@@ -45,12 +45,12 @@ def register_template_handler(*extensions, handler)
unless params.find_all { |type, _| type == :req || type == :opt }.length >= 2
ActiveSupport::Deprecation.warn <<~eowarn
Single arity template handlers are deprecated. Template handlers must
Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
>> #{handler.class}#call(#{params.map(&:last).join(", ")})
>> #{handler}.call(#{params.map(&:last).join(", ")})
To:
>> #{handler.class}#call(#{params.map(&:last).join(", ")}, source)
>> #{handler}.call(#{params.map(&:last).join(", ")}, source)
eowarn
handler = LegacyHandlerWrapper.new(handler)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册