宝石/插件,我使用的是支持我的测试套件调用导致Windows外壳翻身和死亡一些GNU命令只发生一次。我可以用这种方式用旁路重写这些函数:如何使一个函数调用中的Ruby/Rails
def get_rake_output(task)
if RUBY_PLATFORM.include? 'mingw'
puts 'Skipped since OS is Windows. Run the test suite on a UNIX-like shell.'
''
else
`./rake --silent #{task}`
end
end
当然,这会在每次调用函数时打印消息。我如何最好确保它只显示一次?
使用实例变量记住该消息是否已经被显示? – 2010-08-12 19:14:45