違いは何ですか
case item.class
when MyClass
# do something here
when Array
# do something different here
when String
# do a third thing
end
と
case item.class
when MyClass.class
# do something here
when Array.class
# do something different here
when String.class
# do a third thing
end
なんらかの理由で、これらのうちの最初の 1 つが機能する場合と 2 つ目が機能しない場合と、2 つ目が機能する場合と 1 つ目が機能しない場合があります。なんで?それを行う「適切な」方法はどれですか?