Created
June 25, 2010 12:18
-
-
Save ashbb/452774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a replay to Fela's question: | |
| # http://gist.github.com/452089 | |
| # | |
| # Look at Shoes manual, The Rules of Shoes | |
| # - Shoes Tricky Blocks | |
| # - Block Redirection | |
| # | |
| # http://shoes.heroku.com/manual/Rules.html | |
| # | |
| # If you'd like to add all outputs of addparas into the flow slot you defined | |
| # in the Shoes.app block, you need to bring the flow slot object like this: | |
| class Shoes::MyWidget < Shoes::Widget | |
| def initialize slot | |
| @slot = slot | |
| @slot.append do | |
| background blue | |
| para "this is MyWidget" | |
| end | |
| end | |
| def addpara p | |
| @slot.append do | |
| para strong(p) | |
| para self | |
| end | |
| end | |
| end | |
| Shoes.app do | |
| background yellow | |
| @w = my_widget flow(:width => 300, :left => 100) | |
| @w.addpara "XXX" | |
| Thread.new do | |
| sleep 0.1 | |
| @w.addpara "YYY" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment