Ruby 的 YAML 简单示例

2015-05-13 0 791
Ruby 的 YAML 简单示例
require 'yaml'

class Person
  attr_accessor :name, :age
end

fred = Person.new
fred.name = "Fred Bloggs"
fred.age = 45

laura = Person.new
laura.name = "Laura Smith"
laura.age = 23

test_data = [ fred, laura ]

puts YAML::dump(test_data)

遇见资源网 ruby Ruby 的 YAML 简单示例 http://www.ox520.com/16337.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务