From: Mat Schaffer Date: 2006-06-03T04:49:59+09:00 Subject: Re: [QUIZ] Hash to OpenStruct (#81) On Jun 2, 2006, at 3:09 PM, Adam Shelly wrote: > I was throwing different yaml files at my solution and I came > across this > sample of valid YAML which doesn't easily fit into an OpenStruct > > --- > 1: for the money > 2: for the show > 3: to get ready > 4: go go go > > Is this a valid testcase? I set up my test case to work with strange keys (numbers, OpenStruct methods), but I'm not sure what the right behavior is. I see 3 possible behaviors: 1. accept the data and let the client figure out how to get keys like "methods" back out again. (my choice) 2. Throw an exception when trying to store a key that doesn't map to a legal, free function name - then what if they define the same key twice? 3. Try to remove the functions that are already defined, then redefine - can you undefine core ruby functions like 'methods'? -Mat