我对 Ruby 完全陌生。我在变量“@member”中有这些数据
[{"clicks"=>"1", "member"=>{"email"=>"abc@gmail.com", "id"=>"f6d02be6", "euid"=>"f02be6", "email_type"=>"html", "ip_signup"=>nil, "leid"=>"3223865", "clients"=>[], "static_segments"=>[], "notes"=>[]}}, {"clicks"=>"1", "member"=>{"email"=>"dft@gmail.com", "id"=>"336ed115c4", "euid"=>"3365c4", "email_type"=>"html", "ip_signup"=>nil, "timestamp_signup"=>nil, "ip_opt"=>nil, "leid"=>"14877", "clients"=>[], "static_segments"=>[], "notes"=>[]}}, {"clicks"=>"2", "member"=>{"email"=>"man8@gmail.com", "id"=>"334a7f", "euid"=>"334617", "email_type"=>"html", "ip_signup"=>nil, "leid"=>"377", "clients"=>[], "static_segments"=>[], "notes"=>[]}}, {"clicks"=>"1", "member"=>{"email"=>"sub60@gmail.com", "id"=>"4e9b7", "euid"=>"4e9b7", "email_type"=>"html", "ip_signup"=>nil, "timestamp_signup"=>nil, "ip_opt"=>nil, "leid"=>"4605", "clients"=>[], "static_segments"=>[], "notes"=>[]}}, {"clicks"=>"1", "member"=>{"email"=>"mail@moll.com", "id"=>"083fd3", "euid"=>"083fd3", "email_type"=>"html", "ip_signup"=>nil, "timestamp_signup"=>nil, "ip_opt"=>nil, "leid"=>"314649", "clients"=>[], "static_segments"=>[], "notes"=>[] }}]
我需要从上述数据中获取成员电子邮件、euid 和 leid 到结构/哈希数组中。
我试着做
@emails = @member.map { |x| x['member']['email']['euid']['leid'] }
但它返回零。
任何人都可以帮助如何做到这一点?
如果它太基本,但我无法解决它,请原谅。