From: Justin Bailey Date: 2006-10-18T00:19:55+09:00 Subject: Re: Microformat DSL... would like some feedback. ------=_Part_97683_18666529.1161098388869 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/17/06, J2M wrote: > > > I would appreciate any opinions people have on the example so far and > what I may need to include. I checked out the article and I have a couple of suggestions to make the syntax less repetitive. 1) Instead of "has_one" being repeated over and over, why not provide a block & use method_missing (or ara's excellect attributes library, just released) to define all the "has_one" attributes at once: has_one do type :required => true, :length => 10, :select_from => type_options item, :type => :pseudoformat end Single items are a problem above if you are using method_missing, because Ruby can't ttell if they refere to a method or local variable. That is, this wouldn't work quite right: has_one do version summary end In that case, maybe provide an array of words instead: has_one %w(version summary) 2) The ratings options is pretty ugly. All that repetition. How about something like: rating_options 1 .. 5, :worst => 1, :best => 5 Also notice the removal of the "=". Getters can be setters pretty easily (see again, the attributes gem) and it keeps the syntax simple. Hope that helps! Justin ------=_Part_97683_18666529.1161098388869--