[LRUG] Concat and Strings

James McCarthy james2mccarthy at gmail.com
Tue May 13 13:30:11 PDT 2008


Yep; Here is what I have;

index.html.erb
<% ie6 do %>
   body {
     padding: 4px;
   }
<% end %>

module ApplicationHelper

    def wrap(with, &block)
      inner = capture &block
      s = "#{with} { #{inner} }"
      concat s, block.binding
    end

#  In the same helper, I have another method which calls the first  
like this:

    def ie6(&block)
      wrap '* html', &block
    end

end

And this is what it spits out;

* html {
   body {
     padding: 4px;
   }
  }

probably should have pastied it :-/


James
http://thewerks.org.uk



On 13 May 2008, at 21:00, Andrew Stewart wrote:

>
> On 13 May 2008, at 20:19, James McCarthy wrote:
>
>> I just cut and pasted your example and got the latter in 2.0.2
>>
>> James McCarthy
>> http://thewerks.org.uk
>
> Thanks for looking into this.
>
> Do you mean you got this? :-
>
>>> But I can't explain why it doesn't show this instead:
>>>
>>> * html {
>>>  body {
>>>    padding: 4px;
>>>  }
>>> }
>>>
>
>
> Here's what my script/about reports:
>
> About your application's environment
> Ruby version              1.8.6 (i686-darwin9.2.2)  # i.e.  
> patchlevel 114
> RubyGems version          1.0.1
> Rails version             2.0.2
> Active Record version     2.0.2
> Action Pack version       2.0.2
> Active Resource version   2.0.2
> Action Mailer version     2.0.2
> Active Support version    2.0.2
>
> Thanks,
> Andy Stewart
>
> -------
> AirBlade Software
> http://airbladesoftware.com
>
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org




More information about the Chat mailing list