Commit dba2a9eb57391e317100af76538d8c365c7e0b33

Authored by Laust Rud Jacobsen
1 parent cd10674d
Exists in master and in 1 other branch production

Rubocop: move towards fewer single line block invocations

.rubocop_todo.yml
... ... @@ -273,13 +273,10 @@ Style/SignalException:
273 273 - 'lib/airbrake_api/v3/notice_parser.rb'
274 274 - 'lib/hoptoad.rb'
275 275  
276   -# Offense count: 4
  276 +# Offense count: 1
277 277 # Configuration parameters: Methods.
278 278 Style/SingleLineBlockParams:
279 279 Exclude:
280   - - 'app/helpers/application_helper.rb'
281   - - 'app/helpers/form_helper.rb'
282   - - 'app/models/notice_fingerprinter.rb'
283 280 - 'lib/hoptoad/v2.rb'
284 281  
285 282 # Offense count: 11
... ...
app/helpers/form_helper.rb
... ... @@ -5,7 +5,9 @@ module FormHelper
5 5 content_tag(:div, :class => 'error-messages') do
6 6 body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.')
7 7 body + content_tag(:ul) do
8   - document.errors.full_messages.inject('') {|errs, msg| errs + content_tag(:li, h(msg)) }.html_safe
  8 + document.errors.full_messages.inject('') do |errs, msg|
  9 + errs + content_tag(:li, h(msg))
  10 + end.html_safe
9 11 end
10 12 end
11 13 end
... ...
app/models/notice_fingerprinter.rb
... ... @@ -27,6 +27,6 @@ class NoticeFingerprinter
27 27 material << backtrace.lines.slice(0, backtrace_lines)
28 28 end
29 29  
30   - Digest::MD5.hexdigest(material.reduce('') { |c, m| c << m.to_s; c })
  30 + Digest::MD5.hexdigest(material.map(&:to_s).join)
31 31 end
32 32 end
... ...