-
-
Save dsisnero/3197491b0577538fdf36567b851b33f0 to your computer and use it in GitHub Desktop.
find out what Shoes.APPS[] and app are.
This file contains 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
# explore APPS and app (s) | |
# don't name anything as 'app' unless you enjoy confusion | |
class Shoes::Types::App | |
def myinspect(target, from) | |
puts "For #{target.name} (from #{app.name})" | |
#puts "app and from are same object: #{target === app}" | |
puts "instance vars" | |
puts "#{target.inspect}" | |
puts target.instance_variables | |
end | |
def mynew_ivar(target, name, value) | |
target.instance_variable_set(name,value) | |
end | |
def mybinding | |
target.binding() | |
end | |
end | |
Shoes.app title: "Home" do | |
$var_incr = 0 | |
para "Be Confused" | |
window title: "Not_Home" do | |
stack do | |
button "info" do | |
para "#{Shoes.APPS.inspect}\n" | |
para "owner = #{owner}\n" | |
para "me = #{app.inspect}\n" | |
end | |
button "launch" do | |
$var_incr = $var_incr + 1 | |
window title: "really not home #{$var_incr}" do | |
stack do | |
apps = Shoes.APPS | |
para "#{Shoes.APPS.inspect}\n" | |
para "owner = #{owner}\n" | |
para "me = #{app.inspect}\n" | |
stack do | |
apps.each do |item| | |
ivarstr = "@iv#{$var_incr+10}" | |
flow do | |
button "show #{item.name}" do | |
myinspect(item, app) | |
end | |
button "add @ivar" do | |
mynew_ivar(item, "@iv#{$var_incr+10}", "initial value") | |
end | |
button "create alert @ivar" do | |
cmd = "button \"show #{ivarstr}\" do alert \"\#\{#{ivarstr}\}\" end" | |
puts cmd | |
item.instance_eval(cmd) | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
stack do | |
para "#{Shoes.APPS.inspect}" | |
para "owner = #{owner}" | |
para "me = #{app.inspect}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment