diff --git a/examples/arc_challenge2.rb b/examples/arc_challenge2.rb index 7ec36b0..3a06555 100644 --- a/examples/arc_challenge2.rb +++ b/examples/arc_challenge2.rb @@ -9,7 +9,6 @@ $LOAD_PATH.unshift "../lib" require 'rubygems' require 'wee' -require "wee/conversation" class Wee::IO def initialize(component) @@ -17,19 +16,21 @@ def initialize(component) end def ask - @component.display do |r| - text = nil - r.text_input.callback {|t| text = t} - r.submit_button.callback { answer(text) }.value("Enter") + @component.call_inline do |r| + r.form do + text = nil + r.text_input.callback {|t| text = t} + r.submit_button.callback { answer(text) }.value("Enter") + end end end def pause(text) - @component.display {|r| r.anchor.callback { answer }.with(text) } + @component.call_inline {|r| r.anchor.callback { answer }.with(text) } end def tell(text) - @component.display {|r| r.text text.to_s } + @component.call_inline {|r| r.text text.to_s } end end diff --git a/examples/cheese_task.rb b/examples/cheese_task.rb index 5efccb7..50dddb4 100644 --- a/examples/cheese_task.rb +++ b/examples/cheese_task.rb @@ -1,10 +1,8 @@ $LOAD_PATH.unshift "../lib" require 'rubygems' require 'wee' -require 'wee/conversation' class CheeseTask < Wee::Task - def go begin choose_cheese end until confirm_cheese inform_cheese @@ -24,7 +22,6 @@ def confirm_cheese def inform_cheese inform "Your favorite is #{@cheese}." end - end Wee.runcc(CheeseTask) if __FILE__ == $0 diff --git a/examples/demo/counter.rb b/examples/demo/counter.rb index 97fc17c..4111859 100644 --- a/examples/demo/counter.rb +++ b/examples/demo/counter.rb @@ -2,13 +2,12 @@ class Counter < Wee::Component attr_accessor :count def initialize(initial_count=0) - super() - @count = initial_count + @count = initial_count + add_decoration Wee::StyleDecoration.new(self) end - def state(s) - super - s.add_ivar(self, :@count, @count) + def state(s) super + s.add_ivar(self, :@count) end def dec @@ -19,11 +18,12 @@ def inc @count += 1 end + def style + ".wee-Counter a { border: 1px dotted blue; margin: 2px; }" + end + def render(r) - r.once(self.class) { - r.css ".wee-Counter a { border: 1px dotted blue; margin: 2px; }" - } - r.div.id("wee-#{object_id.to_s(36)}").css_class('wee-Counter').with { + r.div.oid.css_class('wee-Counter').with { r.anchor.callback_method(:dec).with("--") r.space render_count(r)