Last active
December 26, 2015 03:48
-
-
Save dreamr/7088041 to your computer and use it in GitHub Desktop.
from mess to clean - showing a dev how to remove conditional logic
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
def calculate_return(last_trade) | |
send(:"calculate_#{recommendation.to_s}_return", last_trade) | |
end |
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
def calculate_return(last_trade) | |
if long? | |
calculate_long_return(last_trade) | |
else | |
calculate_short_return(last_trade) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment