On Wed, Oct 01, 2008 at 12:09:17PM -0400, Seth Thomas Rasmussen wrote:
> Aha. So, after fully reading the Rules, I developed a theory that the
> example shown there is all wrong because inside the app() block, self
> is changed to your app, which has no @stack instance.

You're totally right.  The methods need to be reversed, I messed it
up.

  class Messenger
    def initialize(stack)
      @stack = stack
    end
    def add(msg)
      @stack.append do
        @stack.app do
          para msg
        end
      end
    end
  end
  
  Shoes.app do
    fill "#F90"
    s = stack
    m = Messenger.new(s)
    s.button "OK" do
      m.add("TEST")
    end
  end

I'm not completely happy with this.  It might be better just to wrap `append` in
instance_eval as well.  I just hate messing with scope like that.

_why

Reply via email to