Skip to content

Instantly share code, notes, and snippets.

@rodrigoflores
Created August 25, 2011 12:59
Show Gist options
  • Save rodrigoflores/1170593 to your computer and use it in GitHub Desktop.
Save rodrigoflores/1170593 to your computer and use it in GitHub Desktop.
Case where with classes
case my_var
when String then puts "It is a string"
when Integer then puts "It is an integer"
else puts "It is another thing"
end
#instead of
case my_var.class
when String then puts "It is a string"
when Integer then puts "It is an integer"
else puts "It is another thing"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment