Compares File::Stat objects by comparing their respective modification times. : stat « File Directory « Ruby






Compares File::Stat objects by comparing their respective modification times.


f1 = File.new("f1", "w")
sleep 1
f2 = File.new("f2", "w")
f1.stat <=> f2.stat 
# Methods in Comparable are also available
f1.stat > f2.stat # false
f1.stat < f2.stat # true 

 








Related examples in the same category