This is complex.... I mean puts is generally 'put to stream'... By  
default, kernal.puts goes to the terminal io object. It makes sense in  
a haml scope that the stream should be the haml stream. However this  
illustrates some intersting aspects of doing that...

There has got to be a way to have this make more sense....


- Hampton

On 18-Oct-08, at 2:44 AM, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:

>
> The issue is that Haml::Helpers, which is included in the scope  
> object,
> redefines "puts" as a Haml helper method. In retrospect, this was
> probably a stupid thing to name the helper method, and will likely be
> changed in the future. For now, though, if you call Kernel.puts
> explicitly you should be fine.
>
> fred wrote:
>> I tried to call render method from Haml::Engine, passing the scope as
>> an Object and I get an error
>>
>> /Library/Ruby/Gems/1.8/gems/haml-2.0.2/lib/haml/helpers.rb:262:in
>> `puts': undefined method `buffer' for nil:NilClass (NoMethodError)
>>
>> But if I pass string as the scope it will be fine.
>>
>> e.g
>>
>> class QuickRenderer
>>
>> def version
>> @version ||= 1
>> end
>>
>> def out
>> puts Haml::Engine.new("%p= version").render(self)
>> end
>>
>> end
>>
>>
>> I was expecting that the template scope will be the QuickRenderer
>> instance itself by passing "self" as the scope.
>> I tried with
>>
>> Haml::Engine.new("%p= version").render(binding)
>>
>> doesn't work as well. Any idea?
>>
>>>
>>
>>
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to