# Creation d'une methode qui s'executera en tant que thread def tre for i in 1..10 puts "tre" sleep(0.5) end end #Creation d'un objet qui s’executera en tant que thread class TR2 def tre2 for i in 1..10 puts "tre2" sleep(0.3) end end end # Instantiation d'un objet obj = TR2.new puts "Declaration des threads" t1 = Thread.new{tre} t2 = Thread.new{obj.tre2} puts "Execution des threads" t1.join t2.join