At 00:53 2006-06-05, you wrote: >On Mon, Jun 05, 2006 at 02:55:42AM +0900, Joey wrote: > > I tried to look into changing YAML.load to make OpenStruct's instead of > > hashes, but I soon gave up on that :) > >Your curiousity shouldn't go unmet. > > require 'yaml' > require 'ostruct' > > class << YAML::DefaultResolver > alias_method :_node_import, :node_import > def node_import(node) > o = _node_import(node) > o.is_a?(Hash) ? OpenStruct.new(o) : o > end > end > >_why Hi Another idea would be to use the latest CVS version of RbYAML to do it like this, where data is a string or IO to the YAML data: require 'ostruct' require 'rbyaml' RbYAML.add_builtin_ctor("map") {|ctor,node| OpenStruct.new(ctor.construct_mapping(node)) } RbYAML.load(data) This dosn't really work for mentalguys problem, since RbYAML doesn't support recursive nodes right now. Regards Ola Bini