Skip to content

Commit

Permalink
quick refactor to make a future pull request more focused
Browse files Browse the repository at this point in the history
We can use `reduce` here to easily get the result of applying the transformations
without overwriting the original `email` variable.
  • Loading branch information
QuotableWater7 committed Jun 28, 2016
1 parent 62100ce commit e968e39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -7,6 +7,9 @@ TrailingComma:
AccessModifierIndentation:
EnforcedStyle: outdent

SingleLineBlockParams:
Enabled: false

MethodLength:
Max: 15

Expand Down
4 changes: 1 addition & 3 deletions lib/email_repair/mechanic.rb
Expand Up @@ -34,9 +34,7 @@ def repair_all(emails)
def repair(email)
return unless email

repairs.each { |repair| email = repair.repair(email) }

email
repairs.reduce(email) { |memo, repair| repair.repair(memo) }
end

class CommonMistakeRepair
Expand Down

0 comments on commit e968e39

Please sign in to comment.