在Ruby中是否可以使用这样的东西
if @subscription.state = ['trail', 'active']
#Do something
end
Run Code Online (Sandbox Code Playgroud)
应该是自我解释的.
你可以使用include?ruby的方法Array
if ['trail', 'active'].include?(@subscription.state)
#do something
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
122 次 |
| 最近记录: |