Re: Get OpenStruct attributes
On Mar 13, 6:53 pm, "Arlen Cuss" <cel...@sairyx.org> wrote:
> Hi,
>
> On Fri, Mar 14, 2008 at 2:11 AM, Trans <transf...@gmail.com> wrote:
> > It may be the only reliable way. Try #dup on an OpenStruct and see
> > what happens.
>
> Very good point. Thank you. I think it'd be good if OpenStruct told us about
> those fields, though. (e.g. by creating the methods on dup)
I agree, which is why I created OpenObject (in Facets). OpenObject
will also happily override any built in method, unlike OpenStruct. On
the other hand I was also convinced that a light weight solution is
often all that is needed, so I recently added OpenHash as well. So
that's another alternative.
T.
|