From: Douglas Seifert Date: 2013-06-06T12:02:18+09:00 Subject: Re: Create a nested structure from a CSV --047d7b5d474eb586bf04de738a98 Content-Type: text/plain; charset=ISO-8859-1 My effort here: https://gist.github.com/seifertd/5718964 I think this would be easier to work with if implemented using classes and a utility method that converted a user to a nested hash. -Doug On Wed, Jun 5, 2013 at 5:02 PM, Tamara Temple wrote: > Oli Sanders wrote: > > Joel Pearson wrote in post #1111319: > > > You have attributes like "is supervisor". Maybe a Hash isn't the best > > > way to do this. What about a custom class with its own attributes and > > > links? > > > > > > > Hi Joel, > > Thanks for responding. I had considered something like that but I want > > to generate different views based on the proposed structure. > > > > I think the nested structure would make that easier, and also help me > > when I need to edit it in forms (eventually). > > Actually, I'd go ahead and use ActiveRecord or Sequel with an sqlite > database, which can be memory mapped if you don't want it to persist > across uses. This lets you do ORMish things like: > > user.name > user.id > user.supervisor > user.supervisor.name > user.supervisor.supervisor.supervisor.name (and so on) > > And if you end up with even more attributes, win. > > --047d7b5d474eb586bf04de738a98 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
My effort here:

https://gist.github.com/seifertd/5718964

=
I think this would be easier to work with if implemented u= sing classes and a utility method that converted a user to a nested hash.

-Doug


On Wed, Jun 5, 2013 at 5:02 PM, Tamara = Temple <tamouse.lists@gmail.com> wrote:
Oli Sanders <lists@ruby-forum.com> wrote:
> Joel Pearson wrote in post #1111319:
> > You have attributes like "is supervisor". Maybe a Hash = isn't the best
> > way to do this. What about a custom class with its own attributes= and
> > links?
> >
>
> Hi Joel,
> Thanks for responding. I had considered something like that but I want=
> to generate different views based on the proposed structure.
>
> I think the nested structure would make that easier, and also help me<= br> > when I need to edit it in forms (eventually).

Actually, I'd go ahead and use ActiveRecord or Sequel with an sql= ite
database, which can be memory mapped if you don't want it to persist across uses. This lets you do ORMish things like:

user.name
user.id
user.supervisor
user.supervisor.n= ame
user.supervisor.supervisor.supervisor.name (and so on)

And if you end up with even more attributes, win.


--047d7b5d474eb586bf04de738a98--