📜  ruby 删除数组的第一个元素 - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:45.655000             🧑  作者: Mango

代码示例2
# First of all you have to use splat (*) operator. 
# Then instead of using .slice() and .except() together, you can do this is more efficient way.

columns_to_show = ['age', 'gender', 'cast', 'fee_status']
columns_to_show = columns_to_show - hidden_columns if hidden_columns

patient.slice(*columns_to_show).values

patient.slice('age', 'gender', 'cast', 'fee_status').except(*hidden_columns)
 => {"cast"=>"black", "fee_status"=>"paid"}