Skip to content

Instantly share code, notes, and snippets.

@toreriklinnerud
Forked from jcf/refactor-this.rb
Created October 8, 2010 15:45
Show Gist options
  • Save toreriklinnerud/616996 to your computer and use it in GitHub Desktop.
Save toreriklinnerud/616996 to your computer and use it in GitHub Desktop.
count = 90
total = 100
%w(red amber green).map.with_index do |color, index|
color if ((index + 1)/ 3.0) > (count.to_f / total.to_f)
end.compact.first
@jcf
Copy link

jcf commented Oct 8, 2010

Ten points :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment