第一次使用chef / ruby
User 1 rate 7
User 2 rate 6
User 1 rate 5
=> (7+6+5)/3 = 6
我希望第buildNumber = String.new
ruby_block 'test' do
block do
def parse_xml
buildNumber = "123"
end
parse_xml do
end
print "buildNumber is: " +buildNumber
end
action :run
end
行打印出123而不是空白,我该如何实现?
答案 0 :(得分:0)
我把整个事情放在一个开始端块中,如下所示,它起作用了。
buildNumber = String.new
ruby_block 'test' do
block do
begin
buildNumber = "123"
end
print "buildNumber is: " +buildNumber
end
action :run
end