[LRUG] Concat and Strings

Andrew Stewart boss at airbladesoftware.com
Wed May 14 00:58:11 PDT 2008


On 13 May 2008, at 21:30, James McCarthy wrote:

> And this is what it spits out;
>
> * html {
>  body {
>    padding: 4px;
>  }
> }


Aha!  Thanks to you, I've cracked it.

You ran the experiment in a normal Rails ERB template.  I ran the  
experiment in a normal Rails ERB template, post-processed by my  
css_dryer code.

So the ERB evaluated to what you got (quoted above), and then  
css_dryer did what it was supposed to, de-nesting it to this:

   * html body {
     padding: 4px;
   }

I had somehow forgotten about the post-processing.

The puzzle of the optional closing brace inside the wrap method, where  
this:

   def wrap(with, &block)
     inner = capture &block
     s = "#{with} { #{inner}"  # N.B. no matching } at end of string
     concat s, block.binding
   end

still leads to this css_dryer'd output:

   * html body {
     padding: 4px;
   }

is a bug in css_dryer revealing itself for the first time, after  
almost a year and a half of use.

Thanks again,
Andy Stewart

-------
AirBlade Software
http://airbladesoftware.com







More information about the Chat mailing list