Ruby:我如何组合多个块?

时间:2017-07-21 08:25:16

标签: ruby chef

我的代码executeChef resource

execute 'phpbrew_0' do
    command 'phpbrew --verbose install 5.6 +apxs2'
end

execute 'phpbrew_1' do
    command 'phpbrew --verbose install 7.0 +apxs2'
end

execute 'phpbrew_2' do
    command 'phpbrew --verbose install 7.1 +apxs2'
end

ruby​​是否具有此功能,我可以提供command的集合,并将它们全部传递给execute资源。像Javascript的Array.map

1 个答案:

答案 0 :(得分:2)

是的,<div style="margin: 0 auto; overflow: auto;"> <div style="background: #000; height: 200px; width: 100%; overflow: hidden;"> <h1 style="font-family: Snell Roundhand, cursive; padding-left: 10px; color: white; float: left;">New Trend Photography</h1> <p style="font-size: 14px; color: white; float: right; padding-right: 10px; max-width: 35%;"> <span style="float:right">E-mail: </span> <br> newtrendphotography23@gmail.com </p> </div> </div>,例如:https://ruby-doc.org/core-2.4.1/Hash.html#method-i-each

Hash#each