Ruby 将哈希数据转成 YAML

require 'yaml'

puts ({ 'measurements' => 'metric' }.to_yaml)
puts ({ :measurements => :metric }.to_yaml)

编程技巧