@@ -605,17 +605,31 @@ statx_mtimespec(const rb_io_stat_data *st)
605605
606606/*
607607 * call-seq:
608- * stat <=> other_stat -> -1, 0, 1, nil
608+ * self <=> other -> -1, 0, 1, or nil
609609 *
610- * Compares File::Stat objects by comparing their respective modification
611- * times .
610+ * Compares +self+ and +other+, by comparing their modification times;
611+ * that is, by comparing <tt>self.mtime</tt> and <tt>other.mtime</tt> .
612612 *
613- * +nil+ is returned if +other_stat+ is not a File::Stat object
613+ * Returns:
614614 *
615- * f1 = File.new("f1", "w")
616- * sleep 1
617- * f2 = File.new("f2", "w")
618- * f1.stat <=> f2.stat #=> -1
615+ * - +-1+, if <tt>self.mtime</tt> is earlier.
616+ * - +0+, if the two values are equal.
617+ * - +1+, if <tt>self.mtime</tt> is later.
618+ * - +nil+, if +other+ is not a File::Stat object.
619+ *
620+ * Examples:
621+ *
622+ * stat0 = File.stat('README.md')
623+ * stat1 = File.stat('NEWS.md')
624+ * stat0.mtime # => 2025-12-20 15:33:05.6972341 -0600
625+ * stat1.mtime # => 2025-12-20 16:02:08.2672945 -0600
626+ * stat0 <=> stat1 # => -1
627+ * stat0 <=> stat0.dup # => 0
628+ * stat1 <=> stat0 # => 1
629+ * stat0 <=> :foo # => nil
630+ *
631+ * \Class \File::Stat includes module Comparable,
632+ * each of whose methods uses File::Stat#<=> for comparison.
619633 */
620634
621635static VALUE
0 commit comments