| In: |
yaml/rubytypes.rb
|
| Parent: | Object |
Structs: export as a !map
# File yaml/rubytypes.rb, line 154 def to_yaml( opts = {} ) YAML::quick_emit( self.object_id, opts ) { |out| # # Basic struct is passed as a YAML map # struct_name = self.class.name.gsub( "Struct::", "" ) out.map( "!ruby/struct:#{struct_name}" ) { |map| self.members.each { |m| map.add( m, self[m] ) } self.to_yaml_properties.each { |m| map.add( m, instance_variable_get( m ) ) } } } end