Skip to content

Instantly share code, notes, and snippets.

@ymek
Created April 4, 2011 17:13
Show Gist options
  • Select an option

  • Save ymek/901997 to your computer and use it in GitHub Desktop.

Select an option

Save ymek/901997 to your computer and use it in GitHub Desktop.
Consolidation is legibility
###
# We can change C-style if-statements to something more legible in Ruby
# though it's likely a few cycles less efficient
###
# From this...
if @project_name == 'cowbell' or @project_name == 'aquarium' or @project_name == 'weblib' or @project_name == 'tinysong' or @project_name == 'conf' or @project_name == 'html5' or @project_name == 'conf'
# do something...
end
# To this...
if %w{ cowbell aquarium weblib tinysong conf html5 conf }.include? @project_name
# do somethings...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment