From: Joel VanderWerf Date: 2008-11-27T02:30:27+09:00 Subject: Re: Exclude members from YAML conversion? Christian Kerth wrote: >> You can override yaml_properties to return only the ones you want to be >> in the yaml string. > > where do i overwrite this method? > > in my user object? > > can you give an example? > > thx require 'yaml' class C attr_reader :x, :y, :z def initialize x, y, z @x, @y, @z = x, y, z end def to_yaml_properties super - ["@x"] end end c = C.new 1, 2, 3 p c.to_yaml_properties puts c.to_yaml __END__ Output: ["@y", "@z"] --- !ruby/object:C y: 2 z: 3 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407