That's pretty damned cool.  Good technique!

--beppu

On Thu, Aug 28, 2008 at 3:46 AM, zimbatm <[EMAIL PROTECTED]> wrote:

> This is a nice little trick to defer some block execution in a multi-pane
> layout
>
> module Views
>  def layout
>    html do
>      #...
>      body do
>        div.main { yield }
>        div.right! &@_right_pane if @_right_pane
>      end
>    end
>  end
>
>  def _right_pane(&block)
>    @_right_pane = block
>  end
>
>  # So now on your view
>  def some_view
>    # use that method if you need the right pane
>    _right_pane do
>      # Some code in the right pane
>    end
>
>    # And here goes your regular view
>  end
> end
>
> Cheers,
>   zimbatm
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to