字段和属性

结构体(记录)

ColorPoint = Struct.new(:x, :y) do
    attr_accessor :color
end

colorPoint = ColorPoint.new(0, 0)
colorPoint.color = "red"

puts "color is '#{colorPoint.color}'"