【发布时间】:2018-08-07 11:55:03
【问题描述】:
我有以下红宝石代码:
EmailTemplate.for(mailer).each do |template|
begin
print '.'
template.upload(publish)
rescue Mandrill::UnknownTemplateError
failed.push(mailer)
end
end
Rubocop 将我的代码更正为:
EmailTemplate.for(mailer).each do |template|
print '.'
template.upload(publish)
rescue Mandrill::UnknownTemplateError
failed.push(mailer)
end
现在它返回以下错误:
syntax error, unexpected keyword_rescue, expecting keyword_end
我该如何解决这个问题?
Rubocop 警告是:
C: Style/RedundantBegin: Redundant begin block detected.
【问题讨论】:
-
你的 Ruby 版本是什么?
-
第一个版本我觉得不错。
-
我的 Ruby 版本是 2.4.1。