Commit dba2a9eb57391e317100af76538d8c365c7e0b33
1 parent
cd10674d
Exists in
master
and in
1 other branch
Rubocop: move towards fewer single line block invocations
Showing
3 changed files
with
5 additions
and
6 deletions
Show diff stats
.rubocop_todo.yml
@@ -273,13 +273,10 @@ Style/SignalException: | @@ -273,13 +273,10 @@ Style/SignalException: | ||
273 | - 'lib/airbrake_api/v3/notice_parser.rb' | 273 | - 'lib/airbrake_api/v3/notice_parser.rb' |
274 | - 'lib/hoptoad.rb' | 274 | - 'lib/hoptoad.rb' |
275 | 275 | ||
276 | -# Offense count: 4 | 276 | +# Offense count: 1 |
277 | # Configuration parameters: Methods. | 277 | # Configuration parameters: Methods. |
278 | Style/SingleLineBlockParams: | 278 | Style/SingleLineBlockParams: |
279 | Exclude: | 279 | Exclude: |
280 | - - 'app/helpers/application_helper.rb' | ||
281 | - - 'app/helpers/form_helper.rb' | ||
282 | - - 'app/models/notice_fingerprinter.rb' | ||
283 | - 'lib/hoptoad/v2.rb' | 280 | - 'lib/hoptoad/v2.rb' |
284 | 281 | ||
285 | # Offense count: 11 | 282 | # Offense count: 11 |
app/helpers/form_helper.rb
@@ -5,7 +5,9 @@ module FormHelper | @@ -5,7 +5,9 @@ module FormHelper | ||
5 | content_tag(:div, :class => 'error-messages') do | 5 | content_tag(:div, :class => 'error-messages') do |
6 | body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.') | 6 | body = content_tag(:h2, 'Dang. The following errors are keeping this from being a success.') |
7 | body + content_tag(:ul) do | 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 | end | 11 | end |
10 | end | 12 | end |
11 | end | 13 | end |
app/models/notice_fingerprinter.rb
@@ -27,6 +27,6 @@ class NoticeFingerprinter | @@ -27,6 +27,6 @@ class NoticeFingerprinter | ||
27 | material << backtrace.lines.slice(0, backtrace_lines) | 27 | material << backtrace.lines.slice(0, backtrace_lines) |
28 | end | 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 | end | 31 | end |
32 | end | 32 | end |