Skip to content

Instantly share code, notes, and snippets.

@bsimpson
Created October 29, 2012 15:42
Show Gist options
  • Select an option

  • Save bsimpson/3974262 to your computer and use it in GitHub Desktop.

Select an option

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