Skip to content

Instantly share code, notes, and snippets.

@dreamr
Last active December 26, 2015 03:48
Show Gist options
  • Save dreamr/7088041 to your computer and use it in GitHub Desktop.
Save dreamr/7088041 to your computer and use it in GitHub Desktop.
from mess to clean - showing a dev how to remove conditional logic
def calculate_return(last_trade)
send(:"calculate_#{recommendation.to_s}_return", last_trade)
end
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