fork download
  1. #encoding: utf-8
  2. require 'yaml'
  3. require 'pp'
  4.  
  5. recs = YAML.load( STDIN.readlines.join );
  6.  
  7. pp recs;
  8. print "\n\n";
  9.  
  10. data_no2 = recs[1];
  11. printf "%sさんの測定データ2回め: 身長=%d, 体重=%d\n",
  12. data_no2[:name], *data_no2[:hw][1].values;
  13.  
Success #stdin #stdout 0.04s 9032KB
stdin
---
- :name: 山田
  :hw:
  - :h: 173
    :w: 60
  - :h: 176
    :w: 61
- :name: 佐藤
  :hw:
  - :h: 137
    :w: 40
  - :h: 176
    :w: 16
stdout
[{:name=>"山田", :hw=>[{:h=>173, :w=>60}, {:h=>176, :w=>61}]},
 {:name=>"佐藤", :hw=>[{:h=>137, :w=>40}, {:h=>176, :w=>16}]}]


佐藤さんの測定データ2回め: 身長=176, 体重=16