Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.