Showing changes from revision #2 to #3:
Added | Removed
Markaby är en Ruby-DSL för att skapa HTML. (namnet kommer av “Markup as Ruby”).
Projektet startades av Why the lucky stiff.
Det används i hans mikrowebbramverk Camping.Camping.
Det fungerar genom metaprogrammering; här är dokumentations förklaring av modulens method_missing:
method_missing(sym, *args, &block) Create XML markup based on the name of the method sym. This method is never invoked directly, but is called for each markup method in the markup block. This method is also used to intercept calls to helper methods and instance variables. Here is the order of interception: * If sym is a recognized HTML tag, the tag is output or a CssProxy is returned if no arguments are given. * If sym appears to be a self-closing tag, its block is ignored, thus outputting a valid self-closing tag. * If sym is also the name of an instance variable, the value of the instance variable is returned. * If sym is a helper method, the helper method is called and output to the stream. * Otherwise, sym and its arguments are passed to tag!
RDoc-dokumentationen är väldigt didaktisk och berättar mycket om hur saker hänger ihop. Ett gott exempel!