このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 2.7.0 リファレンスマニュアル

instance method Rake::FileTask#timestamp

timestamp -> Time | Rake::LateTime[permalink][rdoc]

ファイルタスクのタイムスタンプを返します。

# Rakefile での記載例とする

task default: "test.txt"
file "test.txt" do |task|
  Rake.application.options.build_all = false
  task.timestamp # => #<Rake::LateTime:0x2ba58f0>
end