08 note08

・ハッシュのマージ
mydata08.yml
==============================
# <<

common: &common
  user: dbuser
  password: dbpassword

development:
  database: myapp_dev
  <<: *common

production:
  database: myapp_prod
  <<: *common

test:
  database: myapp_test
  <<: *common
==============================



parse08.rb
==============================
require 'yaml'

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

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


ruby parse08.rb   
#=> 
{"common"=>{"user"=>"dbuser", "password"=>"dbpassword"}, "development"=>{"database"=>"myapp_dev", "user"=>"dbuser", "password"=>"dbpassword"}, "production"=>{"database"=>"myapp_prod", "user"=>"dbuser", "password"=>"dbpassword"}, "test"=>{"database"=>"myapp_test", "user"=>"dbuser", "password"=>"dbpassword"}}