Ruby - Variables and Data Types
Find the bug in this Ruby code:
def check_type(obj)
if obj.is_a?(Array)
puts "Array detected"
elsif obj.class == Hash
puts "Hash detected"
else
puts "Unknown type"
end
end
class MyHash < Hash; end
check_type(MyHash.new)