Skip to content

Instantly share code, notes, and snippets.

@ashbb
Created June 25, 2010 12:18
Show Gist options
  • Select an option

  • Save ashbb/452774 to your computer and use it in GitHub Desktop.

Select an option

Save ashbb/452774 to your computer and use it in GitHub Desktop.
# 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