我正在执行以下操作:
array_variable = collection.map do |param|
some value with param
end
return array_variable.compact
我可以以某种方式在一个语句中调用map
and ,以便立即返回结果吗?compact
我正在考虑这样的事情(但是它可能是无效的):
array_variable = block_code param.compact
# block_code here is a method for example which fills the array