05 note05

シーケンスのマッピング
マッピングのシーケンス
mydata05.yml
==============================
# 配列、ハッシュ

 os:
   - centOS
   - ubuntu
 ver:
   - 7
   - 16

# names: [taguchi, fkoji]
# scores: [90, 100]

# - name: taguchi
#   score: 90
# - name: fkoji
#   score: 100

- {name: taguchi, score: 90}
- {name: fkoji, score: 100}
==============================



parse05.rb
==============================
require 'yaml'

emails = YAML.load_file('mydata05.yml')

p emails
==============================


ruby parse05.rb   
#=> {"os"=>["centOS", "ubuntu"], "ver"=>[7, 16]}
#=> [{"name"=>"taguchi", "score"=>90}, {"name"=>"fkoji", "score"=>100}]