Skip to content

Instantly share code, notes, and snippets.

@rachidcalazans
Created December 31, 2017 17:02
Show Gist options
  • Save rachidcalazans/a28029b603a4f1a69830b59cd84469be to your computer and use it in GitHub Desktop.
Save rachidcalazans/a28029b603a4f1a69830b59cd84469be to your computer and use it in GitHub Desktop.
Example I refactored for the Post - avoiding-conditionals
def render_msg(state)
state_msgs = {
in_progress: 'In Progress',
done: 'Done',
on_review: 'On Review'
}
state_msgs[state]
end
render_msg(:in_progress) #=> "In Progress"
render_msg(:done) #=> "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment