-
-
Save myronmarston/1155222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
day = case self.type | |
when 'fast' then :fast_completion_day | |
when 'super_fast' then :super_fast_completion_day | |
when 'ludicrous' then :ludicrous_completion_day | |
else :budget_completion_day | |
end | |
self.value = Increment.first.max_hours * Incrementor.first.send(day) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is probably about as short and dry as you can get it. That said, I'm not sure that this is more clear/easy to read. I'd probably add a method to Incrementor like
Incrementor#completion_day_for(type)
that would take care of this logic for you.