有人可以指出我关于循环遍历数组并提取所需值的正确方向吗?这让我无法理解它:
array = [{"response_message"=>nil, "response_client_message"=>nil, "response_customer_message"=>nil, "closed"=>true, "updated_at"=>2012-05-30 13:20:49 UTC, "created_at"=>2012-05-30 13:20:29 UTC, "token"=>"2fda85eab962fa6e27850605f2f948ca", "price"=>"$24.00", "amount"=>#<BigDecimal:7fa3f4485428,'0.24E2',9(18)>, "currency_code"=>"USD", "metadata"=>"{\"xxx\": 5, \"xxx\": 250, \"xxx\": true, \"support\": { \"email\": true, \"phone\": false } }", "line_items"=>[{"amount"=>#<BigDecimal:7fa3f4482fe8,'0.24E2',9(18)>, "notes"=>nil, "currency_code"=>"USD", "description"=>"1 day", "price"=>"$24.00", "feature_level"=>"{\"hotspots\": 5, \"vouchers\": 250, \"customizable_logins\": true, \"support\": { \"email\": true, \"phone\": false } }", "metadata"=>"{\"hotspots\": 5, \"vouchers\": 250, \"customizable_logins\": true, \"support\": { \"email\": true, \"phone\": false } }"}]}]
其中一个每天都会生成,我需要循环并呈现一些值。我试过这个:
array.select{|elem| elem[:updated_at]}
但这给了我一个[]。
如何循环并提取值?我还需要了解如何获取 line_items 数组。
谢谢