From: andrea Date: 2009-01-05T19:15:10+09:00 Subject: Re: Reimplementation address book program On 4 Gen, 22:08, Todd Benson wrote: > On Sun, Jan 4, 2009 at 1:53 PM, andrea wrote: > These are hard questions to answer, because they involve many other > questions (like, do you require a certain look or user interface, are > you adverse to learning a new framework, time constraints, > performance, etc.)  Rails is pretty heavy duty, but if you plan on > learning it anyway and don't mind a little feature bloat, I suppose it > might work for you. > So I think I will go to rails after, but I like to do things gradually when I'm learning something. I'm not in hurry (there's already an interfacean working even if incomplete) d I'm firstly interested in learning now. > > Are you stuck with Haml?  Maybe take a look at Camping and Markaby if > the requirements for the web-based app are not overly rigorous. No Haml is really fine, it was just to know if it could work anyway... I think it could, as long as apache calls a ruby file each time and the ruby file renders the template > > I haven't played with the LDAP library yet, so I can't comment on it. > There's active_ldap but I don't get it to work on Leopard and even on ubuntu 8.04, not a big deal net/ldap is just fine for me. I don't understand why only here on ruby half of my messages are not actually posted even it gives me no errros... I'll have to remember to write them inside textmate so I can repost them. This is a start point of the classes I need (not many in fact) class Entry attr_reader :multiple, :long def initialize(ar1, ar2) @multiple = ["mobile", "telephoneNumber", "mail"] @long = ["description"] end end class Person < Entry # they can just be readonly attributes attr_reader :attrs, :cn, :sn, :fields # inside other there is a hash containing all other fields set def initialize(cn, sn, other) @attrs = { :attributes => ["cn", "sn", "o", "ou", "mobile", "telephoneNumber", "mail", "description"], :strict => ["cn", "sn"], :dn => ["dn"] } # super @fields = {:cn => cn, :sn => sn} other.each_pair do |key, val| # don't overwrite already compiled fields if @attrs[:attributes].member?(key) and (not @fields.has_key? (key)) @fields[key] = val end end end def to_s pp @fields end end class Factory < Entry attr_reader :attrs def initialize(o) @@attrs = { :attributes => ["o","telephoneNumber","facsimileTelephoneNumber","l","postalCode","street","description"], :strict => ["o"], :dn => ["o"] } @o = o end end Then there are some methods that retrieve or updates the informations and some templates to show everything.