Skip to content

Instantly share code, notes, and snippets.

@danlynn
Created May 5, 2014 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlynn/88b496ecf72ff81cdad3 to your computer and use it in GitHub Desktop.
Save danlynn/88b496ecf72ff81cdad3 to your computer and use it in GitHub Desktop.
cattle = ['hereford', 'angus', 'brahman', 'holstein']
dogs = ['terrier', 'akita', 'poodle', 'afghan']
breed = 'afghan'
animal_type = case breed
when *cattle
'cow'
when *dogs
'dog'
end
puts animal_type #=> "dog"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment