Shoes ; notation ; Ruby
メモ記事御免
self object
Shoes.app do stack do para 'HelloWorld' para 'Thanks' end end
- changes self object
- app block
- window and dialog methods
- not changes self object
- stack block
because of the fact source
Shoes.app do self.stack do self.para 'HelloWorld' self.para 'Thanks' end end
- Whenever you create a new window, self is also changed.
Shoes.app title: "MAIN" do para self button "Spawn" do window title: "CHILD" do para self end end end
Instance variable
- instance variable ends up in app block
Shoes.app do @var = 30 # only within this block end
stack
Shoes.app do stack do para "First" para "Second" para "Third" end end
When attach a stack and give it a block, the App object places that stack in its memory.
The stack gets popped off when block ends up.
All drawing inside the block gets redirected from the App's top slot to the new stack.
External Module and methods
Tell app to change itself by method '.app'
each Shoes object has an app method that will let you reopen the App object
Without the method, app will not change even you meant to 'change' with 'stack
works ; Messenger can tell app to invoke para class Messenger def initialize(stack) @stack = stack end def add(msg) @stack.app do @stack.append do para msg end end end end
not work ; Messenger couldn't tell app to invoke para class Messenger def initialize(stack) @stack = stack end def add(msg) @stack.append do para msg end end end
Fixed Heights
- Fixed heights on slots should be less common
- the slot becomes a nested window
- A new layer is created by the operating system to keep the slot in a fixed square.
UTF-8
- cut down on the amount of conversion
- Shoes expects all strings to be in UTF-8 format.
Main App and reuquire
class Storage; end Shoes.app do para Storage.new end
keep your temporary classes in the code with the app and keep your permanent classes in requires.
Storage class will dispappear once the app complets.
- Other apps cannnot be able to use the Storage class.
- When require code, that code will stick around
- It will be kept in the Ruby top-level environment
情報元/引用元 # thanks