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

instance method Rake::Application#top_level

top_levelRuby 1.9.3 から[permalink][rdoc][edit]

Rake アプリケーションに与えられたトップレベルのタスク (コマンドラインで指定されたタスク) を実行します。

# Rakefile での記載例とする

task default: :test1
task :test1
task :test2 do
  puts "test2"
end

# rake test2 で実行
Rake.application.top_level

# => "test2"