capistrano中的符号字符串concat

时间:2013-11-27 05:50:25

标签: ruby capistrano

我正在运行capistrano 3。

我如何才能使下面的行为正确?

我期待cap deploy:test_symbols返回“你是男人!”

  task :test_symbols do
    set :what, 'the man!'
    puts "you are #{:what}"

    # below causes error:
    # undefined local variable or method `what' for main:Object

    puts "you are #{what}"

  end

1 个答案:

答案 0 :(得分:3)

当您set变量时,您需要fetch使用它:

task :test_symbols do
  set :what, 'the man!'
  puts "you are #{fetch(:what)}"
end