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

instance method Rake::TaskManager#in_namespace

in_namespace(name) {|name_space| ... } -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]

与えられた名前の名前空間でブロックを評価します。

[PARAM] name:
名前を指定します。
# Rakefile での記載例とする

task default: :test_rake_app

namespace :sample do
  def hoge
    puts "hoge"
  end
end

task :test_rake_app do
  task.application.in_namespace("sample") do
    p hoge # => "hoge"
  end
end