To chime in a little bit... because instance variables such as @stack are
defined on self, they will no longer be visible.  However, you can work
around this by copying @stack to a local variable, which will then be
visible within your block.

e.g.

st = @stack
@stack.app do
  st.append do
    para msg
  end
end

-Kevin
On Thu, Jan 22, 2009 at 1:57 PM, Alexander Rakoczy
<[email protected]>wrote:

> Hi Jae!
>
> Methods named "app" will change the value of self!  Check out:
>
> http://help.shoooes.net/Rules.html
>
> I'm not quite sure what you're doing here, but do you really need the
> @stack.app block?
>
> On Thu, Jan 22, 2009 at 15:38, Jae Hess <[email protected]> wrote:
> > Hey Shoers!
> >
> > Giving the following code (taken from http://help.shoooes.net)
> >
> >  class Messenger
> >   def initialize(stack)
> >     @stack = stack
> >   end
> >   def add(msg)
> >     @stack.app do
> >       @stack.append do
> >         para msg
> >       end
> >     end
> >   end
> >  end
> >
> > If I pass in a Shoes stack instance, I am running into an issue where
> after
> > calling @stack.app, @stack is nil when calling append.
> >
> > Anyone else run into this issue?
> >
> > Thanks in advance!
> >
> > Cheers!
> >
> > Jae
> >
>
>
>
> --
> alexander rakoczy
>

Reply via email to