Skip to content

Instantly share code, notes, and snippets.

@bsimpson
Created October 29, 2012 15:42
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 bsimpson/3974262 to your computer and use it in GitHub Desktop.
Save bsimpson/3974262 to your computer and use it in GitHub Desktop.
Case on class
class Foo
end
def test_class(foo)
case foo.class
when Foo
puts "foo"
else
puts "other"
end
end
foo = Foo.new
test_class(foo) # => "other"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment