wee 0.10.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +127 -0
- data/Rakefile +11 -32
- data/doc/rdoc/classes/Array.html +28 -24
- data/doc/rdoc/classes/Hash.html +28 -24
- data/doc/rdoc/classes/Object.html +37 -84
- data/doc/rdoc/classes/String.html +89 -21
- data/doc/rdoc/classes/Struct.html +32 -82
- data/doc/rdoc/classes/Wee.html +285 -86
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +111 -48
- data/doc/rdoc/classes/Wee/{Context.html → AnswerDecoration/Answer.html} +61 -51
- data/doc/rdoc/classes/Wee/Application.html +161 -322
- data/doc/rdoc/classes/Wee/Application/SessionCache.html +162 -0
- data/doc/rdoc/classes/Wee/Brush.html +147 -62
- data/doc/rdoc/classes/{Enumerable.html → Wee/Brush/ActionInputTag.html} +68 -41
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +150 -100
- data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +132 -46
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +63 -41
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +184 -78
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +48 -65
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +83 -37
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +334 -310
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +74 -54
- data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +64 -74
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +109 -86
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +205 -45
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +96 -34
- data/doc/rdoc/classes/Wee/Brush/Page.html +129 -67
- data/doc/rdoc/classes/Wee/{Utils/LRUCache.html → Brush/PasswordInputTag.html} +65 -38
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +132 -78
- data/doc/rdoc/classes/Wee/Brush/{RadioButtonTag/RadioGroup.html → RadioGroup.html} +91 -53
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +301 -127
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +59 -44
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +94 -57
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +181 -121
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +94 -32
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +257 -71
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/CallAnswerMixin.html +289 -0
- data/doc/rdoc/classes/Wee/CallbackMixin.html +233 -0
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +179 -155
- data/doc/rdoc/classes/Wee/Callbacks.html +262 -0
- data/doc/rdoc/classes/Wee/Component.html +228 -779
- data/doc/rdoc/classes/Wee/Decoration.html +144 -159
- data/doc/rdoc/classes/Wee/DecorationMixin.html +340 -0
- data/doc/rdoc/classes/Wee/Delegate.html +119 -76
- data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +64 -47
- data/doc/rdoc/classes/Wee/ErrorResponse.html +59 -62
- data/doc/rdoc/classes/Wee/FormDecoration.html +51 -37
- data/doc/rdoc/classes/Wee/GenericResponse.html +60 -35
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +1000 -602
- data/doc/rdoc/classes/Wee/HtmlDocument.html +288 -0
- data/doc/rdoc/classes/Wee/HtmlWriter.html +227 -126
- data/doc/rdoc/classes/Wee/IdGenerator.html +60 -31
- data/doc/rdoc/classes/Wee/IdGenerator/Secure.html +282 -0
- data/doc/rdoc/classes/Wee/{SimpleIdGenerator.html → IdGenerator/Sequential.html} +76 -49
- data/doc/rdoc/classes/Wee/JQuery.html +221 -0
- data/doc/rdoc/classes/Wee/LRUCache.html +514 -0
- data/doc/rdoc/classes/Wee/LRUCache/Item.html +158 -0
- data/doc/rdoc/classes/Wee/ObjectSnapshotMixin.html +187 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +88 -59
- data/doc/rdoc/classes/Wee/Presenter.html +124 -704
- data/doc/rdoc/classes/Wee/RedirectResponse.html +64 -33
- data/doc/rdoc/classes/Wee/RefreshResponse.html +59 -44
- data/doc/rdoc/classes/Wee/Renderer.html +234 -54
- data/doc/rdoc/classes/Wee/Request.html +151 -286
- data/doc/rdoc/classes/Wee/Response.html +29 -212
- data/doc/rdoc/classes/Wee/Session.html +585 -360
- data/doc/rdoc/classes/Wee/{StateHolder.html → Session/AbortCallbackProcessing.html} +67 -40
- data/doc/rdoc/classes/Wee/Session/MutexSerializer.html +166 -0
- data/doc/rdoc/classes/{Cache/Strategy/LFU/Item.html → Wee/Session/Page.html} +26 -27
- data/doc/rdoc/classes/Wee/Session/ThreadSerializer.html +219 -0
- data/doc/rdoc/classes/Wee/State.html +307 -0
- data/doc/rdoc/classes/{Cache/Strategy/LRU/Item.html → Wee/State/Snapshot.html} +26 -27
- data/doc/rdoc/classes/{Cache/Strategy/Unbounded/Item.html → Wee/State/SnapshotIVars.html} +26 -27
- data/doc/rdoc/classes/Wee/StructSnapshotMixin.html +183 -0
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +101 -35
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +243 -0
- data/doc/rdoc/files/lib/wee/application_rb.html +22 -30
- data/doc/rdoc/files/lib/wee/{page_rb.html → call_answer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/callback_rb.html +12 -29
- data/doc/rdoc/files/lib/wee/component_rb.html +22 -27
- data/doc/rdoc/files/lib/wee/decoration_rb.html +19 -20
- data/doc/rdoc/files/lib/wee/{idgen_rb.html → html_brushes_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/html_canvas_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{abstractsession_rb.html → html_document_rb.html} +17 -25
- data/doc/rdoc/files/lib/wee/html_writer_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{webrick_rb.html → id_generator_rb.html} +19 -25
- data/doc/rdoc/files/lib/wee/{core/page_rb.html → jquery/jquery_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/{state_registry_rb.html → jquery_rb.html} +17 -27
- data/doc/rdoc/files/lib/{cache/cache_rb.html → wee/lru_cache_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/presenter_rb.html +12 -34
- data/doc/rdoc/files/lib/wee/{holder_rb.html → renderer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/request_rb.html +18 -32
- data/doc/rdoc/files/lib/wee/response_rb.html +17 -24
- data/doc/rdoc/files/lib/wee/session_rb.html +21 -23
- data/doc/rdoc/files/lib/wee/state_rb.html +90 -0
- data/doc/rdoc/files/lib/wee_rb.html +48 -40
- data/doc/rdoc/fr_class_index.html +111 -75
- data/doc/rdoc/fr_file_index.html +46 -76
- data/doc/rdoc/fr_method_index.html +473 -480
- data/doc/rdoc/index.html +6 -9
- data/doc/rdoc/rdoc-style.css +210 -119
- data/examples/ObjectSpaceBrowser.rb +33 -23
- data/examples/ajax.rb +71 -0
- data/examples/continuations.rb +28 -0
- data/examples/demo.rb +92 -36
- data/examples/demo/calculator.rb +63 -0
- data/examples/demo/calendar.rb +42 -55
- data/examples/demo/counter.rb +38 -0
- data/{lib/wee/examples → examples/demo}/editable_counter.rb +11 -6
- data/examples/demo/example.rb +28 -24
- data/examples/demo/file_upload.rb +19 -0
- data/{lib/wee/components → examples/demo}/messagebox.rb +3 -3
- data/examples/demo/radio.rb +33 -0
- data/{lib/wee/examples → examples/demo}/window.rb +15 -10
- data/examples/hw.rb +3 -4
- data/{lib/wee/components → examples}/pager.rb +14 -14
- data/lib/wee.rb +48 -25
- data/lib/wee/application.rb +69 -131
- data/lib/wee/call_answer.rb +118 -0
- data/lib/wee/callback.rb +88 -0
- data/lib/wee/component.rb +141 -0
- data/lib/wee/decoration.rb +242 -0
- data/lib/wee/html_brushes.rb +725 -0
- data/lib/wee/html_canvas.rb +241 -0
- data/lib/wee/html_document.rb +45 -0
- data/lib/wee/html_writer.rb +71 -0
- data/lib/wee/id_generator.rb +70 -0
- data/lib/wee/jquery.rb +1 -0
- data/lib/wee/jquery/jquery.rb +17 -0
- data/lib/wee/jquery/public/jquery-1.3.2.min.js +19 -0
- data/lib/wee/jquery/public/wee-jquery.js +19 -0
- data/lib/wee/lru_cache.rb +89 -0
- data/lib/wee/presenter.rb +43 -0
- data/lib/wee/renderer.rb +65 -0
- data/lib/wee/request.rb +37 -113
- data/lib/wee/response.rb +43 -70
- data/lib/wee/session.rb +304 -113
- data/lib/wee/state.rb +85 -0
- data/test/component_spec.rb +17 -0
- data/wee.gemspec +4 -3
- metadata +249 -452
- data/ChangeLog +0 -657
- data/INSTALL +0 -17
- data/README +0 -272
- data/TODO +0 -142
- data/benchmark/Centrino1300/result.2000.counter.action +0 -45
- data/benchmark/Centrino1300/result.2000.counter.render +0 -43
- data/benchmark/Centrino1300/result.2000.filehandler +0 -43
- data/benchmark/Centrino600/result.2000.counter.action +0 -47
- data/benchmark/Centrino600/result.2000.counter.render +0 -45
- data/benchmark/Centrino600/result.2000.filehandler +0 -43
- data/benchmark/Makefile +0 -53
- data/benchmark/counter.rb +0 -77
- data/benchmark/filehandler.rb +0 -6
- data/benchmark/report_req.rb +0 -12
- data/bin/wee +0 -100
- data/doc/rdoc/classes/ActionView.html +0 -107
- data/doc/rdoc/classes/ActionView/Base.html +0 -133
- data/doc/rdoc/classes/Cache.html +0 -126
- data/doc/rdoc/classes/Cache/StorageCache.html +0 -320
- data/doc/rdoc/classes/Cache/Strategy.html +0 -128
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +0 -269
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +0 -225
- data/doc/rdoc/classes/LiteralMethod.html +0 -196
- data/doc/rdoc/classes/Main.html +0 -289
- data/doc/rdoc/classes/OgApplication.html +0 -126
- data/doc/rdoc/classes/OgScaffolder.html +0 -827
- data/doc/rdoc/classes/OgScaffolder/Editor.html +0 -565
- data/doc/rdoc/classes/OgSession.html +0 -172
- data/doc/rdoc/classes/Recipe.html +0 -113
- data/doc/rdoc/classes/Wee/AbstractSession.html +0 -502
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/ActionMixin.html +0 -146
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +0 -154
- data/doc/rdoc/classes/Wee/Brush/AssignMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/CallbackMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +0 -158
- data/doc/rdoc/classes/Wee/Brush/ToCallback.html +0 -146
- data/doc/rdoc/classes/Wee/Callback.html +0 -231
- data/doc/rdoc/classes/Wee/CallbackStream.html +0 -227
- data/doc/rdoc/classes/Wee/Canvas.html +0 -235
- data/doc/rdoc/classes/Wee/CanvasMixin.html +0 -225
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +0 -153
- data/doc/rdoc/classes/Wee/ComponentDispatcher.html +0 -289
- data/doc/rdoc/classes/Wee/ComponentRunner.html +0 -321
- data/doc/rdoc/classes/Wee/ErrorPage.html +0 -175
- data/doc/rdoc/classes/Wee/Examples.html +0 -114
- data/doc/rdoc/classes/Wee/Examples/Calculator.html +0 -319
- data/doc/rdoc/classes/Wee/Examples/Counter.html +0 -289
- data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +0 -210
- data/doc/rdoc/classes/Wee/Examples/Window.html +0 -346
- data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +0 -227
- data/doc/rdoc/classes/Wee/Helper.html +0 -148
- data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +0 -1230
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +0 -198
- data/doc/rdoc/classes/Wee/LoginDecoration.html +0 -261
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +0 -181
- data/doc/rdoc/classes/Wee/MessageBox.html +0 -180
- data/doc/rdoc/classes/Wee/MethodCallback.html +0 -193
- data/doc/rdoc/classes/Wee/Nitro.html +0 -114
- data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +0 -345
- data/doc/rdoc/classes/Wee/Nitro/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +0 -178
- data/doc/rdoc/classes/Wee/Page.html +0 -115
- data/doc/rdoc/classes/Wee/PagelessApplication.html +0 -154
- data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +0 -296
- data/doc/rdoc/classes/Wee/PagelessRequest.html +0 -208
- data/doc/rdoc/classes/Wee/PagelessSession.html +0 -359
- data/doc/rdoc/classes/Wee/Pager.html +0 -534
- data/doc/rdoc/classes/Wee/Rails.html +0 -114
- data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +0 -342
- data/doc/rdoc/classes/Wee/Rails/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +0 -177
- data/doc/rdoc/classes/Wee/RenderingContext.html +0 -283
- data/doc/rdoc/classes/Wee/RequestHandler.html +0 -341
- data/doc/rdoc/classes/Wee/Snapshot.html +0 -211
- data/doc/rdoc/classes/Wee/StateRegistry.html +0 -434
- data/doc/rdoc/classes/Wee/StateRegistry/Snapshot.html +0 -320
- data/doc/rdoc/classes/Wee/StateRegistry/WithObject.html +0 -153
- data/doc/rdoc/classes/Wee/Utils.html +0 -300
- data/doc/rdoc/classes/Wee/ValueHolder.html +0 -220
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +0 -368
- data/doc/rdoc/files/INSTALL.html +0 -130
- data/doc/rdoc/files/README.html +0 -471
- data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/component_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/pager_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/continuation_rb.html +0 -116
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/core/component_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +0 -133
- data/doc/rdoc/files/lib/wee/core/idgen_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +0 -112
- data/doc/rdoc/files/lib/wee/core/renderer_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +0 -113
- data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core_rb.html +0 -124
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/examples/counter_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/examples/window_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +0 -109
- data/doc/rdoc/files/lib/wee/pageless_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/rendering/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/snapshot_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/stuff_rb.html +0 -144
- data/doc/rdoc/files/lib/wee/template_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/cache_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils_rb.html +0 -110
- data/examples/ajax/ajax.js +0 -444
- data/examples/ajax/ajax.rb +0 -31
- data/examples/cc.rb +0 -74
- data/examples/dispatcher.rb +0 -37
- data/examples/draw.rb +0 -94
- data/examples/live-update.rb +0 -45
- data/examples/nitro/run.rb +0 -42
- data/examples/og-test.rb +0 -60
- data/examples/radio.rb +0 -44
- data/examples/test.rb +0 -39
- data/install.rb +0 -14
- data/lib/cache/cache.rb +0 -167
- data/lib/wee/abstractsession.rb +0 -96
- data/lib/wee/adaptors/fastcgi.rb +0 -76
- data/lib/wee/adaptors/nitro.rb +0 -155
- data/lib/wee/adaptors/rails.rb +0 -154
- data/lib/wee/adaptors/webrick.rb +0 -89
- data/lib/wee/components.rb +0 -7
- data/lib/wee/components/component_dispatcher.rb +0 -46
- data/lib/wee/components/form_decoration.rb +0 -7
- data/lib/wee/components/login_decoration.rb +0 -35
- data/lib/wee/components/page_decoration.rb +0 -14
- data/lib/wee/components/wrapper_decoration.rb +0 -7
- data/lib/wee/continuation.rb +0 -5
- data/lib/wee/continuation/core/component.rb +0 -56
- data/lib/wee/continuation/session.rb +0 -64
- data/lib/wee/core.rb +0 -16
- data/lib/wee/core/callback.rb +0 -121
- data/lib/wee/core/component.rb +0 -356
- data/lib/wee/core/componentrunner.rb +0 -73
- data/lib/wee/core/context.rb +0 -27
- data/lib/wee/core/decoration.rb +0 -138
- data/lib/wee/core/idgen.rb +0 -5
- data/lib/wee/core/page.rb +0 -1
- data/lib/wee/core/presenter.rb +0 -100
- data/lib/wee/core/renderer.rb +0 -23
- data/lib/wee/core/snapshot.rb +0 -21
- data/lib/wee/core/valueholder.rb +0 -19
- data/lib/wee/core_ext.rb +0 -122
- data/lib/wee/databases/og.rb +0 -4
- data/lib/wee/databases/og/application.rb +0 -3
- data/lib/wee/databases/og/old_scaffolder.rb +0 -98
- data/lib/wee/databases/og/scaffolder.rb +0 -255
- data/lib/wee/databases/og/session.rb +0 -9
- data/lib/wee/examples/calculator.rb +0 -70
- data/lib/wee/examples/counter.rb +0 -33
- data/lib/wee/idgen/md5.rb +0 -21
- data/lib/wee/idgen/sequential.rb +0 -11
- data/lib/wee/pageless.rb +0 -3
- data/lib/wee/pageless/application.rb +0 -13
- data/lib/wee/pageless/request.rb +0 -27
- data/lib/wee/pageless/session.rb +0 -74
- data/lib/wee/renderer/html/brushes.rb +0 -667
- data/lib/wee/renderer/html/canvas.rb +0 -265
- data/lib/wee/renderer/html/writer.rb +0 -80
- data/lib/wee/requesthandler.rb +0 -81
- data/lib/wee/skeleton/og/README +0 -38
- data/lib/wee/skeleton/og/components/main.rb +0 -20
- data/lib/wee/skeleton/og/conf/db.rb +0 -8
- data/lib/wee/skeleton/og/models/recipe.rb +0 -5
- data/lib/wee/skeleton/og/run.rb +0 -23
- data/lib/wee/skeleton/simple/README +0 -32
- data/lib/wee/skeleton/simple/components/main.rb +0 -25
- data/lib/wee/skeleton/simple/run.rb +0 -12
- data/lib/wee/snapshot_ext.rb +0 -41
- data/lib/wee/template.rb +0 -42
- data/lib/wee/utils.rb +0 -5
- data/lib/wee/utils/autoreload.rb +0 -56
- data/lib/wee/utils/cache.rb +0 -7
- data/lib/wee/utils/helper.rb +0 -51
@@ -0,0 +1,262 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>Class: Wee::Callbacks [RDoc Documentation]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
8
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
9
|
+
<script type="text/javascript">
|
10
|
+
// <![CDATA[
|
11
|
+
|
12
|
+
function popupCode( url ) {
|
13
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
14
|
+
}
|
15
|
+
|
16
|
+
function toggleCode( id ) {
|
17
|
+
if ( document.getElementById )
|
18
|
+
elem = document.getElementById( id );
|
19
|
+
else if ( document.all )
|
20
|
+
elem = eval( "document.all." + id );
|
21
|
+
else
|
22
|
+
return false;
|
23
|
+
|
24
|
+
elemStyle = elem.style;
|
25
|
+
|
26
|
+
if ( elemStyle.display != "block" ) {
|
27
|
+
elemStyle.display = "block"
|
28
|
+
} else {
|
29
|
+
elemStyle.display = "none"
|
30
|
+
}
|
31
|
+
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Make codeblocks hidden by default
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
38
|
+
// ]]>
|
39
|
+
</script>
|
40
|
+
|
41
|
+
</head>
|
42
|
+
<body>
|
43
|
+
|
44
|
+
|
45
|
+
<div id="classHeader">
|
46
|
+
<table class="header-table">
|
47
|
+
<tr class="top-aligned-row">
|
48
|
+
<td><strong>Class</strong></td>
|
49
|
+
<td class="class-name-in-header">Wee::Callbacks</td>
|
50
|
+
</tr>
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>In:</strong></td>
|
53
|
+
<td>
|
54
|
+
|
55
|
+
|
56
|
+
<a href="../../files/lib/wee/callback_rb.html">
|
57
|
+
|
58
|
+
lib/wee/callback.rb
|
59
|
+
|
60
|
+
</a>
|
61
|
+
|
62
|
+
|
63
|
+
<br />
|
64
|
+
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
|
68
|
+
|
69
|
+
<tr class="top-aligned-row">
|
70
|
+
<td><strong>Parent:</strong></td>
|
71
|
+
<td>
|
72
|
+
|
73
|
+
<a href="../Object.html">
|
74
|
+
|
75
|
+
Object
|
76
|
+
|
77
|
+
</a>
|
78
|
+
|
79
|
+
</td>
|
80
|
+
</tr>
|
81
|
+
|
82
|
+
</table>
|
83
|
+
</div>
|
84
|
+
<!-- banner header -->
|
85
|
+
|
86
|
+
<div id="bodyContent">
|
87
|
+
|
88
|
+
<div id="contextContent">
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
|
98
|
+
<a href="#M000221">new</a>
|
99
|
+
|
100
|
+
<a href="#M000222">unregister</a>
|
101
|
+
|
102
|
+
<a href="#M000223">with_triggered</a>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<!-- if includes -->
|
110
|
+
|
111
|
+
<div id="section">
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<div id="attribute-list">
|
116
|
+
<h3 class="section-bar">Attributes</h3>
|
117
|
+
|
118
|
+
<div class="name-list">
|
119
|
+
<table>
|
120
|
+
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">action_callbacks</td>
|
123
|
+
|
124
|
+
<td class="context-item-value"> [R] </td>
|
125
|
+
|
126
|
+
<td class="context-item-desc"></td>
|
127
|
+
</tr>
|
128
|
+
|
129
|
+
<tr class="top-aligned-row context-row">
|
130
|
+
<td class="context-item-name">input_callbacks</td>
|
131
|
+
|
132
|
+
<td class="context-item-value"> [R] </td>
|
133
|
+
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
|
137
|
+
</table>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
<!-- if method_list -->
|
143
|
+
|
144
|
+
<div id="methods">
|
145
|
+
|
146
|
+
<h3 class="section-bar">Public Class methods</h3>
|
147
|
+
|
148
|
+
|
149
|
+
<div id="method-M000221" class="method-detail">
|
150
|
+
<a name="M000221"></a>
|
151
|
+
|
152
|
+
<div class="method-heading">
|
153
|
+
|
154
|
+
<a href="#M000221" class="method-signature">
|
155
|
+
|
156
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
157
|
+
|
158
|
+
</a>
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
|
164
|
+
<p><a class="source-toggle" href="#"
|
165
|
+
onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
|
166
|
+
<div class="method-source-code" id="M000221-source">
|
167
|
+
<pre>
|
168
|
+
<span class="ruby-comment cmt"># File lib/wee/callback.rb, line 67</span>
|
169
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
170
|
+
<span class="ruby-ivar">@input_callbacks</span> = <span class="ruby-constant">CallbackRegistry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">""</span>)
|
171
|
+
<span class="ruby-ivar">@action_callbacks</span> = <span class="ruby-constant">CallbackRegistry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"a"</span>)
|
172
|
+
<span class="ruby-keyword kw">end</span>
|
173
|
+
</pre>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
181
|
+
|
182
|
+
|
183
|
+
<div id="method-M000222" class="method-detail">
|
184
|
+
<a name="M000222"></a>
|
185
|
+
|
186
|
+
<div class="method-heading">
|
187
|
+
|
188
|
+
<a href="#M000222" class="method-signature">
|
189
|
+
|
190
|
+
<span class="method-name">unregister</span><span class="method-args">(object)</span>
|
191
|
+
|
192
|
+
</a>
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
|
198
|
+
<p><a class="source-toggle" href="#"
|
199
|
+
onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
|
200
|
+
<div class="method-source-code" id="M000222-source">
|
201
|
+
<pre>
|
202
|
+
<span class="ruby-comment cmt"># File lib/wee/callback.rb, line 72</span>
|
203
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">object</span>)
|
204
|
+
<span class="ruby-ivar">@input_callbacks</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">object</span>)
|
205
|
+
<span class="ruby-ivar">@action_callbacks</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-identifier">object</span>)
|
206
|
+
<span class="ruby-keyword kw">end</span>
|
207
|
+
</pre>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
|
214
|
+
<div id="method-M000223" class="method-detail">
|
215
|
+
<a name="M000223"></a>
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
|
219
|
+
<a href="#M000223" class="method-signature">
|
220
|
+
|
221
|
+
<span class="method-name">with_triggered</span><span class="method-args">(ids_and_values) {|| ...}</span>
|
222
|
+
|
223
|
+
</a>
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
|
229
|
+
<p><a class="source-toggle" href="#"
|
230
|
+
onclick="toggleCode('M000223-source');return false;">[Source]</a></p>
|
231
|
+
<div class="method-source-code" id="M000223-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment cmt"># File lib/wee/callback.rb, line 77</span>
|
234
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_triggered</span>(<span class="ruby-identifier">ids_and_values</span>)
|
235
|
+
<span class="ruby-ivar">@input_callbacks</span>.<span class="ruby-identifier">prepare_triggered</span>(<span class="ruby-identifier">ids_and_values</span>)
|
236
|
+
<span class="ruby-ivar">@action_callbacks</span>.<span class="ruby-identifier">prepare_triggered</span>(<span class="ruby-identifier">ids_and_values</span>)
|
237
|
+
<span class="ruby-keyword kw">yield</span>
|
238
|
+
<span class="ruby-keyword kw">ensure</span>
|
239
|
+
<span class="ruby-ivar">@input_callbacks</span>.<span class="ruby-identifier">reset_triggered</span>
|
240
|
+
<span class="ruby-ivar">@action_callbacks</span>.<span class="ruby-identifier">reset_triggered</span>
|
241
|
+
<span class="ruby-keyword kw">end</span>
|
242
|
+
</pre>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</div>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
<div id="validator-badges">
|
258
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
</body>
|
262
|
+
</html>
|
@@ -1,12 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
6
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
4
|
<head>
|
8
|
-
<title>Class: Wee::Component</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<title>Class: Wee::Component [RDoc Documentation]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
7
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
8
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
9
|
<script type="text/javascript">
|
@@ -25,7 +22,7 @@
|
|
25
22
|
return false;
|
26
23
|
|
27
24
|
elemStyle = elem.style;
|
28
|
-
|
25
|
+
|
29
26
|
if ( elemStyle.display != "block" ) {
|
30
27
|
elemStyle.display = "block"
|
31
28
|
} else {
|
@@ -34,10 +31,10 @@
|
|
34
31
|
|
35
32
|
return true;
|
36
33
|
}
|
37
|
-
|
34
|
+
|
38
35
|
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }
|
40
|
-
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
41
38
|
// ]]>
|
42
39
|
</script>
|
43
40
|
|
@@ -45,7 +42,6 @@
|
|
45
42
|
<body>
|
46
43
|
|
47
44
|
|
48
|
-
|
49
45
|
<div id="classHeader">
|
50
46
|
<table class="header-table">
|
51
47
|
<tr class="top-aligned-row">
|
@@ -55,351 +51,286 @@
|
|
55
51
|
<tr class="top-aligned-row">
|
56
52
|
<td><strong>In:</strong></td>
|
57
53
|
<td>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
|
55
|
+
|
56
|
+
<a href="../../files/lib/wee/component_rb.html">
|
57
|
+
|
58
|
+
lib/wee/component.rb
|
59
|
+
|
64
60
|
</a>
|
61
|
+
|
62
|
+
|
65
63
|
<br />
|
64
|
+
|
66
65
|
</td>
|
67
66
|
</tr>
|
68
67
|
|
68
|
+
|
69
69
|
<tr class="top-aligned-row">
|
70
70
|
<td><strong>Parent:</strong></td>
|
71
71
|
<td>
|
72
|
+
|
72
73
|
<a href="Presenter.html">
|
74
|
+
|
73
75
|
Wee::Presenter
|
76
|
+
|
74
77
|
</a>
|
78
|
+
|
75
79
|
</td>
|
76
80
|
</tr>
|
81
|
+
|
77
82
|
</table>
|
78
83
|
</div>
|
79
84
|
<!-- banner header -->
|
80
85
|
|
81
86
|
<div id="bodyContent">
|
82
87
|
|
83
|
-
|
84
|
-
|
85
88
|
<div id="contextContent">
|
86
89
|
|
87
90
|
<div id="description">
|
88
91
|
<p>
|
89
92
|
The base class of all components. You should at least overwrite method <a
|
90
|
-
href="Component.html#
|
93
|
+
href="Component.html#M000045">render</a> in your own subclasses.
|
91
94
|
</p>
|
92
95
|
|
93
96
|
</div>
|
94
97
|
|
95
|
-
|
96
|
-
<div id="contents-list">
|
97
|
-
<h3 class="section-bar">Contents</h3>
|
98
|
-
<ul>
|
99
|
-
<li><a href="#SEC00080">Render</a></li>
|
100
|
-
<li><a href="#SEC00081">Callback</a></li>
|
101
|
-
<li><a href="#SEC00082">Init</a></li>
|
102
|
-
<li><a href="#SEC00083">Children/Composite</a></li>
|
103
|
-
<li><a href="#SEC00084">Decoration</a></li>
|
104
|
-
<li><a href="#SEC00085">Backtrack</a></li>
|
105
|
-
<li><a href="#SEC00086">Call/Answer</a></li>
|
106
|
-
<li><a href="#SEC00161">Call/Answer</a></li>
|
107
|
-
</ul>
|
108
98
|
</div>
|
109
99
|
|
100
|
+
|
110
101
|
<div id="method-list">
|
111
102
|
<h3 class="section-bar">Methods</h3>
|
112
103
|
|
113
104
|
<div class="name-list">
|
114
|
-
<a href="#M000331">add_child</a>
|
115
|
-
<a href="#M000335">add_decoration</a>
|
116
|
-
<a href="#M000341">answer</a>
|
117
|
-
<a href="#M000339">backtrack_state</a>
|
118
|
-
<a href="#M000338">backtrack_state_chain</a>
|
119
|
-
<a href="#M000340">call</a>
|
120
|
-
<a href="#M000342">call</a>
|
121
|
-
<a href="#M000330">children</a>
|
122
|
-
<a href="#M000332">decoration</a>
|
123
|
-
<a href="#M000333">decoration=</a>
|
124
|
-
<a href="#M000325">do_render_chain</a>
|
125
|
-
<a href="#M000334">each_decoration</a>
|
126
|
-
<a href="#M000329">initialize</a>
|
127
|
-
<a href="#M000328">process_callbacks</a>
|
128
|
-
<a href="#M000327">process_callbacks_chain</a>
|
129
|
-
<a href="#M000336">remove_decoration</a>
|
130
|
-
<a href="#M000337">remove_decoration_if</a>
|
131
|
-
<a href="#M000326">render</a>
|
132
|
-
</div>
|
133
|
-
</div>
|
134
105
|
|
135
|
-
|
106
|
+
<a href="#M000051">add_child</a>
|
136
107
|
|
108
|
+
<a href="#M000047">backtrack</a>
|
137
109
|
|
138
|
-
|
110
|
+
<a href="#M000049">backtrack_children</a>
|
139
111
|
|
140
|
-
|
112
|
+
<a href="#M000048">backtrack_decoration</a>
|
141
113
|
|
114
|
+
<a href="#M000050">each_child</a>
|
142
115
|
|
116
|
+
<a href="#M000044">initialize</a>
|
143
117
|
|
118
|
+
<a href="#M000046">process_callbacks</a>
|
144
119
|
|
120
|
+
<a href="#M000045">render</a>
|
145
121
|
|
146
|
-
|
122
|
+
</div>
|
123
|
+
</div>
|
147
124
|
|
125
|
+
</div>
|
148
126
|
|
149
|
-
<!-- if
|
150
|
-
|
151
|
-
|
152
|
-
<
|
153
|
-
|
154
|
-
</div>
|
127
|
+
<!-- if includes -->
|
128
|
+
|
129
|
+
<div id="includes">
|
130
|
+
<h3 class="section-bar">Included Modules</h3>
|
155
131
|
|
132
|
+
<div id="includes-list">
|
156
133
|
|
134
|
+
<span class="include-name"><a href="DecorationMixin.html">Wee::DecorationMixin</a></span>
|
157
135
|
|
136
|
+
<span class="include-name"><a href="CallAnswerMixin.html">Wee::CallAnswerMixin</a></span>
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="section">
|
158
142
|
|
159
143
|
|
160
|
-
|
161
144
|
|
162
145
|
|
163
146
|
<!-- if method_list -->
|
147
|
+
|
164
148
|
<div id="methods">
|
149
|
+
|
165
150
|
<h3 class="section-bar">Public Instance methods</h3>
|
166
151
|
|
167
|
-
|
168
|
-
|
152
|
+
|
153
|
+
<div id="method-M000047" class="method-detail">
|
154
|
+
<a name="M000047"></a>
|
169
155
|
|
170
156
|
<div class="method-heading">
|
171
|
-
<a href="#M000325" class="method-signature">
|
172
|
-
<span class="method-name">do_render_chain</span><span class="method-args">(rendering_context)</span>
|
173
|
-
</a>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<div class="method-description">
|
177
|
-
<p>
|
178
|
-
Starts rendering the decoration chain by calling method <a
|
179
|
-
href="Presenter.html#M000375">Presenter#do_render</a> for the first
|
180
|
-
decoration of the component, or calling <em>do_render</em> for the
|
181
|
-
component itself if no decorations were specified.
|
182
|
-
</p>
|
183
|
-
<dl>
|
184
|
-
<dt><tt>rendering_context</tt></dt><dd>An object of class <a href="RenderingContext.html">RenderingContext</a>
|
185
157
|
|
186
|
-
|
187
|
-
</dl>
|
188
|
-
<p><a class="source-toggle" href="#"
|
189
|
-
onclick="toggleCode('M000325-source');return false;">[Source]</a></p>
|
190
|
-
<div class="method-source-code" id="M000325-source">
|
191
|
-
<pre>
|
192
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 19</span>
|
193
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rendering_context</span>)
|
194
|
-
<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">do_render</span>(<span class="ruby-identifier">rendering_context</span>)
|
195
|
-
<span class="ruby-keyword kw">end</span>
|
196
|
-
</pre>
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
</div>
|
158
|
+
<a href="#M000047" class="method-signature">
|
200
159
|
|
201
|
-
|
202
|
-
<a name="M000326"></a>
|
160
|
+
<span class="method-name">backtrack</span><span class="method-args">(state)</span>
|
203
161
|
|
204
|
-
<div class="method-heading">
|
205
|
-
<a href="#M000326" class="method-signature">
|
206
|
-
<span class="method-name">render</span><span class="method-args">()</span>
|
207
162
|
</a>
|
163
|
+
|
208
164
|
</div>
|
209
|
-
|
165
|
+
|
210
166
|
<div class="method-description">
|
167
|
+
|
211
168
|
<p>
|
212
|
-
|
169
|
+
Take snapshots of objects that should correctly be backtracked.
|
213
170
|
</p>
|
214
171
|
<p>
|
215
|
-
|
216
|
-
|
172
|
+
Backtracking means that you can go back in time of the components’
|
173
|
+
state. Therefore it is neccessary to take snapshots of those objects that
|
174
|
+
want to participate in backtracking. Taking snapshots of the whole
|
175
|
+
component tree would be too expensive and unflexible. Note that methods
|
176
|
+
<em>take_snapshot</em> and <em>restore_snapshot</em> are called for those
|
177
|
+
objects to take the snapshot (they behave like <em>marshal_dump</em> and
|
178
|
+
<em>marshal_load</em>). Overwrite them if you want to define special
|
179
|
+
behaviour.
|
217
180
|
</p>
|
218
181
|
<p>
|
219
|
-
|
182
|
+
For example if you dynamically add children to your component, you might
|
183
|
+
want to backtrack the children array:
|
220
184
|
</p>
|
221
|
-
<p><a class="source-toggle" href="#"
|
222
|
-
onclick="toggleCode('M000326-source');return false;">[Source]</a></p>
|
223
|
-
<div class="method-source-code" id="M000326-source">
|
224
185
|
<pre>
|
225
|
-
|
226
|
-
|
227
|
-
|
186
|
+
def backtrack(state)
|
187
|
+
super
|
188
|
+
backtrack_children(state)
|
189
|
+
end
|
228
190
|
</pre>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
<div id="section">
|
236
|
-
<h2 class="section-title"><a name="SEC00081">Callback</a></h2>
|
237
|
-
<div class="section-comment">
|
238
|
-
|
239
|
-
</div>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
<!-- if method_list -->
|
249
|
-
<div id="methods">
|
250
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
251
|
-
|
252
|
-
<div id="method-M000328" class="method-detail">
|
253
|
-
<a name="M000328"></a>
|
254
|
-
|
255
|
-
<div class="method-heading">
|
256
|
-
<a href="#M000328" class="method-signature">
|
257
|
-
<span class="method-name">process_callbacks</span><span class="method-args">(&block)</span>
|
258
|
-
</a>
|
259
|
-
</div>
|
260
|
-
|
261
|
-
<div class="method-description">
|
262
|
-
<p>
|
263
|
-
Process and invoke all callbacks specified for this component and all of
|
264
|
-
it’s child components.
|
191
|
+
<p>
|
192
|
+
By default only the decoration chain is backtracked. This is required to
|
193
|
+
correctly backtrack called components. To disable backtracking of the
|
194
|
+
decorations, change method <a
|
195
|
+
href="Component.html#M000048">Component#backtrack_decoration</a> to a
|
196
|
+
no-operation:
|
265
197
|
</p>
|
198
|
+
<pre>
|
199
|
+
def backtrack_decoration(state)
|
200
|
+
# nothing here
|
201
|
+
end
|
202
|
+
</pre>
|
266
203
|
<dl>
|
267
|
-
<dt><tt>
|
268
|
-
callbacks).
|
204
|
+
<dt><tt>state</tt></dt><dd>An object of class <a href="State.html">State</a>
|
269
205
|
|
270
206
|
</dd>
|
271
207
|
</dl>
|
208
|
+
|
272
209
|
<p><a class="source-toggle" href="#"
|
273
|
-
onclick="toggleCode('
|
274
|
-
<div class="method-source-code" id="
|
210
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
211
|
+
<div class="method-source-code" id="M000047-source">
|
275
212
|
<pre>
|
276
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
213
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 88</span>
|
214
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack</span>(<span class="ruby-identifier">state</span>)
|
215
|
+
<span class="ruby-identifier">backtrack_decoration</span>(<span class="ruby-identifier">state</span>)
|
216
|
+
<span class="ruby-identifier">each_child</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
217
|
+
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack</span>(<span class="ruby-identifier">state</span>)
|
218
|
+
<span class="ruby-keyword kw">end</span>
|
283
219
|
<span class="ruby-keyword kw">end</span>
|
284
|
-
<span class="ruby-keyword kw">end</span>
|
285
220
|
</pre>
|
286
221
|
</div>
|
222
|
+
|
287
223
|
</div>
|
288
224
|
</div>
|
289
225
|
|
290
|
-
|
291
|
-
|
226
|
+
|
227
|
+
<div id="method-M000046" class="method-detail">
|
228
|
+
<a name="M000046"></a>
|
292
229
|
|
293
230
|
<div class="method-heading">
|
294
|
-
|
295
|
-
<
|
231
|
+
|
232
|
+
<a href="#M000046" class="method-signature">
|
233
|
+
|
234
|
+
<span class="method-name">process_callbacks</span><span class="method-args">(callbacks)</span>
|
235
|
+
|
296
236
|
</a>
|
237
|
+
|
297
238
|
</div>
|
298
|
-
|
239
|
+
|
299
240
|
<div class="method-description">
|
241
|
+
|
300
242
|
<p>
|
301
|
-
|
302
|
-
|
303
|
-
decoration or the component itself if no decorations were specified.
|
243
|
+
Process and invoke all callbacks specified for this component and all of
|
244
|
+
it’s child components.
|
304
245
|
</p>
|
305
|
-
<dl>
|
306
|
-
<dt><tt>block</tt></dt><dd>Specifies the action to be taken (e.g. whether to invoke input or action
|
307
|
-
callbacks).
|
308
246
|
|
309
|
-
</dd>
|
310
|
-
</dl>
|
311
247
|
<p><a class="source-toggle" href="#"
|
312
|
-
onclick="toggleCode('
|
313
|
-
<div class="method-source-code" id="
|
248
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
249
|
+
<div class="method-source-code" id="M000046-source">
|
314
250
|
<pre>
|
315
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
316
|
-
|
317
|
-
|
318
|
-
|
251
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 40</span>
|
252
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callbacks</span>)
|
253
|
+
<span class="ruby-identifier">callbacks</span>.<span class="ruby-identifier">input_callbacks</span>.<span class="ruby-identifier">each_triggered</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
254
|
+
<span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>)
|
255
|
+
<span class="ruby-keyword kw">end</span>
|
256
|
+
|
257
|
+
<span class="ruby-comment cmt"># process callbacks of all children</span>
|
258
|
+
<span class="ruby-identifier">each_child</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
259
|
+
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callbacks</span>)
|
260
|
+
<span class="ruby-keyword kw">end</span>
|
261
|
+
|
262
|
+
<span class="ruby-identifier">callbacks</span>.<span class="ruby-identifier">action_callbacks</span>.<span class="ruby-identifier">each_triggered</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
263
|
+
<span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>
|
264
|
+
<span class="ruby-identifier">session</span>.<span class="ruby-identifier">send_response</span>(<span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt"># prematurely end callback processing</span>
|
265
|
+
<span class="ruby-keyword kw">end</span>
|
266
|
+
<span class="ruby-keyword kw">end</span>
|
319
267
|
</pre>
|
320
268
|
</div>
|
269
|
+
|
321
270
|
</div>
|
322
271
|
</div>
|
323
272
|
|
324
273
|
|
325
|
-
|
326
|
-
|
327
|
-
<h2 class="section-title"><a name="SEC00082">Init</a></h2>
|
328
|
-
<div class="section-comment">
|
329
|
-
|
330
|
-
</div>
|
331
|
-
|
332
|
-
|
333
|
-
|
274
|
+
<div id="method-M000045" class="method-detail">
|
275
|
+
<a name="M000045"></a>
|
334
276
|
|
277
|
+
<div class="method-heading">
|
335
278
|
|
336
|
-
|
279
|
+
<a href="#M000045" class="method-signature">
|
337
280
|
|
281
|
+
<span class="method-name">render</span><span class="method-args">(r)</span>
|
338
282
|
|
339
|
-
<!-- if method_list -->
|
340
|
-
<div id="methods">
|
341
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
342
|
-
|
343
|
-
<div id="method-M000329" class="method-detail">
|
344
|
-
<a name="M000329"></a>
|
345
|
-
|
346
|
-
<div class="method-heading">
|
347
|
-
<a href="#M000329" class="method-signature">
|
348
|
-
<span class="method-name">initialize</span><span class="method-args">()</span>
|
349
283
|
</a>
|
284
|
+
|
350
285
|
</div>
|
351
|
-
|
286
|
+
|
352
287
|
<div class="method-description">
|
288
|
+
|
353
289
|
<p>
|
354
|
-
|
290
|
+
This method renders the content of the component.
|
355
291
|
</p>
|
356
292
|
<p>
|
357
|
-
|
358
|
-
|
293
|
+
<b>OVERWRITE</b> this method in your own component classes to implement the
|
294
|
+
view. By default this method does nothing!
|
359
295
|
</p>
|
296
|
+
<dl>
|
297
|
+
<dt><tt>r</tt></dt><dd>An instance of class <tt>renderer_class()</tt>
|
298
|
+
|
299
|
+
</dd>
|
300
|
+
</dl>
|
301
|
+
|
360
302
|
<p><a class="source-toggle" href="#"
|
361
|
-
onclick="toggleCode('
|
362
|
-
<div class="method-source-code" id="
|
303
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
304
|
+
<div class="method-source-code" id="M000045-source">
|
363
305
|
<pre>
|
364
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
365
|
-
|
366
|
-
<span class="ruby-
|
367
|
-
<span class="ruby-ivar">@__children</span> = []
|
368
|
-
<span class="ruby-keyword kw">end</span>
|
306
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 33</span>
|
307
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">r</span>)
|
308
|
+
<span class="ruby-keyword kw">end</span>
|
369
309
|
</pre>
|
370
310
|
</div>
|
311
|
+
|
371
312
|
</div>
|
372
313
|
</div>
|
373
314
|
|
374
315
|
|
375
|
-
|
376
|
-
<div id="section">
|
377
|
-
<h2 class="section-title"><a name="SEC00083">Children/Composite</a></h2>
|
378
|
-
<div class="section-comment">
|
379
|
-
|
380
|
-
</div>
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
316
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
385
317
|
|
386
|
-
|
387
318
|
|
319
|
+
<div id="method-M000051" class="method-detail">
|
320
|
+
<a name="M000051"></a>
|
388
321
|
|
389
|
-
|
390
|
-
<div id="methods">
|
391
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
322
|
+
<div class="method-heading">
|
392
323
|
|
393
|
-
|
394
|
-
<a name="M000331"></a>
|
324
|
+
<a href="#M000051" class="method-signature">
|
395
325
|
|
396
|
-
<div class="method-heading">
|
397
|
-
<a href="#M000331" class="method-signature">
|
398
326
|
<span class="method-name">add_child</span><span class="method-args">(child)</span>
|
327
|
+
|
399
328
|
</a>
|
329
|
+
|
400
330
|
</div>
|
401
|
-
|
331
|
+
|
402
332
|
<div class="method-description">
|
333
|
+
|
403
334
|
<p>
|
404
335
|
Add a child to the component. Example:
|
405
336
|
</p>
|
@@ -417,654 +348,172 @@ initialize), then you should consider to backtrack the children array (of
|
|
417
348
|
course only if you want backtracking at all):
|
418
349
|
</p>
|
419
350
|
<pre>
|
420
|
-
def
|
351
|
+
def backtrack(state)
|
421
352
|
super
|
422
|
-
|
353
|
+
state.add(self.children)
|
423
354
|
end
|
424
355
|
</pre>
|
425
|
-
<p><a class="source-toggle" href="#"
|
426
|
-
onclick="toggleCode('M000331-source');return false;">[Source]</a></p>
|
427
|
-
<div class="method-source-code" id="M000331-source">
|
428
|
-
<pre>
|
429
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 117</span>
|
430
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
|
431
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
|
432
|
-
<span class="ruby-identifier">child</span>
|
433
|
-
<span class="ruby-keyword kw">end</span>
|
434
|
-
</pre>
|
435
|
-
</div>
|
436
|
-
</div>
|
437
|
-
</div>
|
438
356
|
|
439
|
-
<div id="method-M000330" class="method-detail">
|
440
|
-
<a name="M000330"></a>
|
441
|
-
|
442
|
-
<div class="method-heading">
|
443
|
-
<a href="#M000330" class="method-signature">
|
444
|
-
<span class="method-name">children</span><span class="method-args">()</span>
|
445
|
-
</a>
|
446
|
-
</div>
|
447
|
-
|
448
|
-
<div class="method-description">
|
449
|
-
<p>
|
450
|
-
Returns all direct child components collected in an array.
|
451
|
-
</p>
|
452
|
-
<p>
|
453
|
-
You can overwrite this method to return all direct child components of this
|
454
|
-
component.
|
455
|
-
</p>
|
456
357
|
<p><a class="source-toggle" href="#"
|
457
|
-
onclick="toggleCode('
|
458
|
-
<div class="method-source-code" id="
|
358
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
359
|
+
<div class="method-source-code" id="M000051-source">
|
459
360
|
<pre>
|
460
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
461
|
-
|
462
|
-
|
463
|
-
|
361
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 131</span>
|
362
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
|
363
|
+
(<span class="ruby-ivar">@children</span> <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
|
364
|
+
<span class="ruby-identifier">child</span>
|
365
|
+
<span class="ruby-keyword kw">end</span>
|
464
366
|
</pre>
|
465
367
|
</div>
|
368
|
+
|
466
369
|
</div>
|
467
370
|
</div>
|
468
371
|
|
469
372
|
|
470
|
-
|
471
|
-
|
472
|
-
<h2 class="section-title"><a name="SEC00084">Decoration</a></h2>
|
473
|
-
<div class="section-comment">
|
474
|
-
|
475
|
-
</div>
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
<!-- if method_list -->
|
485
|
-
<div id="methods">
|
486
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
487
|
-
|
488
|
-
<div id="method-M000335" class="method-detail">
|
489
|
-
<a name="M000335"></a>
|
373
|
+
<div id="method-M000049" class="method-detail">
|
374
|
+
<a name="M000049"></a>
|
490
375
|
|
491
376
|
<div class="method-heading">
|
492
|
-
<a href="#M000335" class="method-signature">
|
493
|
-
<span class="method-name">add_decoration</span><span class="method-args">(d)</span>
|
494
|
-
</a>
|
495
|
-
</div>
|
496
|
-
|
497
|
-
<div class="method-description">
|
498
|
-
<p>
|
499
|
-
Adds decoration <tt>d</tt> to the decoration chain.
|
500
|
-
</p>
|
501
|
-
<p>
|
502
|
-
A global decoration is added in front of the decoration chain, a local
|
503
|
-
decoration is added in front of all other local decorations but after all
|
504
|
-
global decorations.
|
505
|
-
</p>
|
506
|
-
<p>
|
507
|
-
Returns: <tt>self</tt>
|
508
|
-
</p>
|
509
|
-
<p><a class="source-toggle" href="#"
|
510
|
-
onclick="toggleCode('M000335-source');return false;">[Source]</a></p>
|
511
|
-
<div class="method-source-code" id="M000335-source">
|
512
|
-
<pre>
|
513
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 160</span>
|
514
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">d</span>)
|
515
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">global?</span>
|
516
|
-
<span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
517
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>
|
518
|
-
<span class="ruby-keyword kw">else</span>
|
519
|
-
<span class="ruby-identifier">last_global</span> = <span class="ruby-keyword kw">nil</span>
|
520
|
-
<span class="ruby-identifier">each_decoration</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
521
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">global?</span>
|
522
|
-
<span class="ruby-identifier">last_global</span> = <span class="ruby-identifier">i</span>
|
523
|
-
<span class="ruby-keyword kw">else</span>
|
524
|
-
<span class="ruby-keyword kw">break</span>
|
525
|
-
<span class="ruby-keyword kw">end</span>
|
526
|
-
}
|
527
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">nil?</span>
|
528
|
-
<span class="ruby-comment cmt"># no global decorations specified -> add in front</span>
|
529
|
-
<span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
530
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>
|
531
|
-
<span class="ruby-keyword kw">else</span>
|
532
|
-
<span class="ruby-comment cmt"># add after last_global</span>
|
533
|
-
<span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">owner</span>
|
534
|
-
<span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">d</span>
|
535
|
-
<span class="ruby-keyword kw">end</span>
|
536
|
-
<span class="ruby-keyword kw">end</span>
|
537
377
|
|
538
|
-
|
539
|
-
<span class="ruby-keyword kw">end</span>
|
540
|
-
</pre>
|
541
|
-
</div>
|
542
|
-
</div>
|
543
|
-
</div>
|
378
|
+
<a href="#M000049" class="method-signature">
|
544
379
|
|
545
|
-
|
546
|
-
<a name="M000332"></a>
|
380
|
+
<span class="method-name">backtrack_children</span><span class="method-args">(state)</span>
|
547
381
|
|
548
|
-
<div class="method-heading">
|
549
|
-
<a href="#M000332" class="method-signature">
|
550
|
-
<span class="method-name">decoration</span><span class="method-args">()</span>
|
551
382
|
</a>
|
552
|
-
</div>
|
553
|
-
|
554
|
-
<div class="method-description">
|
555
|
-
<p>
|
556
|
-
Returns the first decoration from the component’s decoration chain,
|
557
|
-
or <tt>self</tt> if no decorations were specified for the component.
|
558
|
-
</p>
|
559
|
-
<p><a class="source-toggle" href="#"
|
560
|
-
onclick="toggleCode('M000332-source');return false;">[Source]</a></p>
|
561
|
-
<div class="method-source-code" id="M000332-source">
|
562
|
-
<pre>
|
563
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 131</span>
|
564
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration</span>
|
565
|
-
<span class="ruby-ivar">@__decoration</span>.<span class="ruby-identifier">value</span>
|
566
|
-
<span class="ruby-keyword kw">end</span>
|
567
|
-
</pre>
|
568
|
-
</div>
|
569
|
-
</div>
|
570
|
-
</div>
|
571
|
-
|
572
|
-
<div id="method-M000333" class="method-detail">
|
573
|
-
<a name="M000333"></a>
|
574
383
|
|
575
|
-
<div class="method-heading">
|
576
|
-
<a href="#M000333" class="method-signature">
|
577
|
-
<span class="method-name">decoration=</span><span class="method-args">(d)</span>
|
578
|
-
</a>
|
579
384
|
</div>
|
580
|
-
|
581
|
-
<div class="method-description">
|
582
|
-
<p>
|
583
|
-
Set the pointer to the first decoration to <tt>d</tt>.
|
584
|
-
</p>
|
585
|
-
<p><a class="source-toggle" href="#"
|
586
|
-
onclick="toggleCode('M000333-source');return false;">[Source]</a></p>
|
587
|
-
<div class="method-source-code" id="M000333-source">
|
588
|
-
<pre>
|
589
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 137</span>
|
590
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration=</span>(<span class="ruby-identifier">d</span>)
|
591
|
-
<span class="ruby-ivar">@__decoration</span>.<span class="ruby-identifier">value</span> = <span class="ruby-identifier">d</span>
|
592
|
-
<span class="ruby-keyword kw">end</span>
|
593
|
-
</pre>
|
594
|
-
</div>
|
595
|
-
</div>
|
596
|
-
</div>
|
597
385
|
|
598
|
-
<div id="method-M000334" class="method-detail">
|
599
|
-
<a name="M000334"></a>
|
600
|
-
|
601
|
-
<div class="method-heading">
|
602
|
-
<a href="#M000334" class="method-signature">
|
603
|
-
<span class="method-name">each_decoration</span><span class="method-args">( {|decoration| ...}</span>
|
604
|
-
</a>
|
605
|
-
</div>
|
606
|
-
|
607
386
|
<div class="method-description">
|
608
|
-
<p>
|
609
|
-
Iterates over all decorations (note that the component itself is excluded).
|
610
|
-
</p>
|
611
|
-
<p><a class="source-toggle" href="#"
|
612
|
-
onclick="toggleCode('M000334-source');return false;">[Source]</a></p>
|
613
|
-
<div class="method-source-code" id="M000334-source">
|
614
|
-
<pre>
|
615
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 143</span>
|
616
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_decoration</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
617
|
-
<span class="ruby-identifier">d</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
618
|
-
<span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
619
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">nil?</span>
|
620
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">d</span>
|
621
|
-
<span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span>
|
622
|
-
<span class="ruby-keyword kw">end</span>
|
623
|
-
<span class="ruby-keyword kw">end</span>
|
624
|
-
</pre>
|
625
|
-
</div>
|
626
|
-
</div>
|
627
|
-
</div>
|
628
387
|
|
629
|
-
<div id="method-M000336" class="method-detail">
|
630
|
-
<a name="M000336"></a>
|
631
|
-
|
632
|
-
<div class="method-heading">
|
633
|
-
<a href="#M000336" class="method-signature">
|
634
|
-
<span class="method-name">remove_decoration</span><span class="method-args">(d)</span>
|
635
|
-
</a>
|
636
|
-
</div>
|
637
|
-
|
638
|
-
<div class="method-description">
|
639
|
-
<p>
|
640
|
-
Remove decoration <tt>d</tt> from the decoration chain.
|
641
|
-
</p>
|
642
|
-
<p>
|
643
|
-
Returns the removed decoration or <tt>nil</tt> if it did not exist in the
|
644
|
-
decoration chain.
|
645
|
-
</p>
|
646
388
|
<p><a class="source-toggle" href="#"
|
647
|
-
onclick="toggleCode('
|
648
|
-
<div class="method-source-code" id="
|
389
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
390
|
+
<div class="method-source-code" id="M000049-source">
|
649
391
|
<pre>
|
650
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
651
|
-
|
652
|
-
|
653
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span>
|
654
|
-
<span class="ruby-keyword kw">else</span>
|
655
|
-
<span class="ruby-identifier">last_decoration</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
656
|
-
<span class="ruby-identifier">next_decoration</span> = <span class="ruby-keyword kw">nil</span>
|
657
|
-
<span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
658
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_decoration</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">last_decoration</span>.<span class="ruby-identifier">nil?</span>
|
659
|
-
<span class="ruby-identifier">next_decoration</span> = <span class="ruby-identifier">last_decoration</span>.<span class="ruby-identifier">owner</span>
|
660
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">next_decoration</span>
|
661
|
-
<span class="ruby-identifier">last_decoration</span> = <span class="ruby-identifier">next_decoration</span>
|
662
|
-
<span class="ruby-keyword kw">end</span>
|
663
|
-
<span class="ruby-identifier">last_decoration</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span>
|
392
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 101</span>
|
393
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_children</span>(<span class="ruby-identifier">state</span>)
|
394
|
+
<span class="ruby-identifier">state</span>.<span class="ruby-identifier">add_ivar</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:@children</span>, (<span class="ruby-ivar">@children</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@children</span>.<span class="ruby-identifier">dup</span>))
|
664
395
|
<span class="ruby-keyword kw">end</span>
|
665
|
-
<span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># decoration 'd' no longer is an owner of anything!</span>
|
666
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">d</span>
|
667
|
-
<span class="ruby-keyword kw">end</span>
|
668
396
|
</pre>
|
669
397
|
</div>
|
670
|
-
</div>
|
671
|
-
</div>
|
672
|
-
|
673
|
-
<div id="method-M000337" class="method-detail">
|
674
|
-
<a name="M000337"></a>
|
675
398
|
|
676
|
-
<div class="method-heading">
|
677
|
-
<a href="#M000337" class="method-signature">
|
678
|
-
<span class="method-name">remove_decoration_if</span><span class="method-args">( {|decoration| ...}</span>
|
679
|
-
</a>
|
680
|
-
</div>
|
681
|
-
|
682
|
-
<div class="method-description">
|
683
|
-
<p>
|
684
|
-
Remove all decorations that match the block condition.
|
685
|
-
</p>
|
686
|
-
<p>
|
687
|
-
Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
688
|
-
</p>
|
689
|
-
<pre>
|
690
|
-
remove_decoration_if {|d| d.class == HaloDecoration}
|
691
|
-
</pre>
|
692
|
-
<p><a class="source-toggle" href="#"
|
693
|
-
onclick="toggleCode('M000337-source');return false;">[Source]</a></p>
|
694
|
-
<div class="method-source-code" id="M000337-source">
|
695
|
-
<pre>
|
696
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 217</span>
|
697
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration_if</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
698
|
-
<span class="ruby-identifier">to_remove</span> = []
|
699
|
-
<span class="ruby-identifier">each_decoration</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to_remove</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">d</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">d</span>}
|
700
|
-
<span class="ruby-identifier">to_remove</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">d</span>)}
|
701
|
-
<span class="ruby-keyword kw">end</span>
|
702
|
-
</pre>
|
703
|
-
</div>
|
704
399
|
</div>
|
705
400
|
</div>
|
706
401
|
|
707
402
|
|
708
|
-
|
709
|
-
|
710
|
-
<h2 class="section-title"><a name="SEC00085">Backtrack</a></h2>
|
711
|
-
<div class="section-comment">
|
712
|
-
|
713
|
-
</div>
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
403
|
+
<div id="method-M000048" class="method-detail">
|
404
|
+
<a name="M000048"></a>
|
720
405
|
|
406
|
+
<div class="method-heading">
|
721
407
|
|
722
|
-
|
723
|
-
<div id="methods">
|
724
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
408
|
+
<a href="#M000048" class="method-signature">
|
725
409
|
|
726
|
-
|
727
|
-
<a name="M000339"></a>
|
410
|
+
<span class="method-name">backtrack_decoration</span><span class="method-args">(state)</span>
|
728
411
|
|
729
|
-
<div class="method-heading">
|
730
|
-
<a href="#M000339" class="method-signature">
|
731
|
-
<span class="method-name">backtrack_state</span><span class="method-args">(snapshot)</span>
|
732
412
|
</a>
|
733
|
-
</div>
|
734
|
-
|
735
|
-
<div class="method-description">
|
736
|
-
<p>
|
737
|
-
Take snapshots of objects that should correctly be backtracked.
|
738
|
-
</p>
|
739
|
-
<p>
|
740
|
-
Backtracking means that you can go back in time of the components’
|
741
|
-
state. Therefore it is neccessary to take snapshots of those objects that
|
742
|
-
want to participate in backtracking. Taking snapshots of the whole
|
743
|
-
component tree would be too expensive and unflexible. Note that methods
|
744
|
-
<em>take_snapshot</em> and <em>restore_snapshot</em> are called for those
|
745
|
-
objects to take the snapshot (they behave like <em>marshal_dump</em> and
|
746
|
-
<em>marshal_load</em>). Overwrite them if you want to define special
|
747
|
-
behaviour.
|
748
|
-
</p>
|
749
|
-
<p>
|
750
|
-
By default only <tt>@__decoration</tt> is backtracked (which actually is a
|
751
|
-
<a href="ValueHolder.html">ValueHolder</a>, as only the pointer changes not
|
752
|
-
the decoration-object itself!).
|
753
|
-
</p>
|
754
|
-
<p>
|
755
|
-
For example if you dynamically add children to your component, you might
|
756
|
-
want to backtrack the children array. Therefore you simply pass it to the
|
757
|
-
<a href="Snapshot.html#M000259">Snapshot#add</a> method:
|
758
|
-
</p>
|
759
|
-
<pre>
|
760
|
-
def backtrack_state(snapshot)
|
761
|
-
super
|
762
|
-
snapshot.add(self.children)
|
763
|
-
end
|
764
|
-
</pre>
|
765
|
-
<p>
|
766
|
-
This will call Array#take_snapshot to take the snapshot for the children
|
767
|
-
array. If at a later point in time a snapshot is restored,
|
768
|
-
Array#restore_snapshot will be called with the return value of
|
769
|
-
Array#take_snapshot as argument.
|
770
|
-
</p>
|
771
|
-
<dl>
|
772
|
-
<dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
|
773
413
|
|
774
|
-
</dd>
|
775
|
-
</dl>
|
776
|
-
<p><a class="source-toggle" href="#"
|
777
|
-
onclick="toggleCode('M000339-source');return false;">[Source]</a></p>
|
778
|
-
<div class="method-source-code" id="M000339-source">
|
779
|
-
<pre>
|
780
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 274</span>
|
781
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
|
782
|
-
<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">add</span>(<span class="ruby-ivar">@__decoration</span>)
|
783
|
-
<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snapshot</span>) <span class="ruby-keyword kw">end</span>
|
784
|
-
<span class="ruby-keyword kw">end</span>
|
785
|
-
</pre>
|
786
|
-
</div>
|
787
414
|
</div>
|
788
|
-
</div>
|
789
415
|
|
790
|
-
<div id="method-M000338" class="method-detail">
|
791
|
-
<a name="M000338"></a>
|
792
|
-
|
793
|
-
<div class="method-heading">
|
794
|
-
<a href="#M000338" class="method-signature">
|
795
|
-
<span class="method-name">backtrack_state_chain</span><span class="method-args">(snapshot)</span>
|
796
|
-
</a>
|
797
|
-
</div>
|
798
|
-
|
799
416
|
<div class="method-description">
|
800
|
-
<p>
|
801
|
-
Starts the backtrack-state phase for the decoration chain, by invoking
|
802
|
-
method <a href="Component.html#M000339">backtrack_state</a> of the first
|
803
|
-
decoration or the component itself if no decorations were specified.
|
804
|
-
</p>
|
805
|
-
<p>
|
806
|
-
See <a href="Component.html#M000339">backtrack_state</a> for details.
|
807
|
-
</p>
|
808
|
-
<dl>
|
809
|
-
<dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
|
810
417
|
|
811
|
-
</dd>
|
812
|
-
</dl>
|
813
418
|
<p><a class="source-toggle" href="#"
|
814
|
-
onclick="toggleCode('
|
815
|
-
<div class="method-source-code" id="
|
419
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
420
|
+
<div class="method-source-code" id="M000048-source">
|
816
421
|
<pre>
|
817
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
818
|
-
|
819
|
-
|
820
|
-
|
422
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 97</span>
|
423
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_decoration</span>(<span class="ruby-identifier">state</span>)
|
424
|
+
<span class="ruby-identifier">state</span>.<span class="ruby-identifier">add_ivar</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:@decoration</span>, <span class="ruby-ivar">@decoration</span>)
|
425
|
+
<span class="ruby-keyword kw">end</span>
|
821
426
|
</pre>
|
822
427
|
</div>
|
428
|
+
|
823
429
|
</div>
|
824
430
|
</div>
|
825
431
|
|
826
432
|
|
827
|
-
|
828
|
-
|
829
|
-
<h2 class="section-title"><a name="SEC00086">Call/Answer</a></h2>
|
830
|
-
<div class="section-comment">
|
831
|
-
|
832
|
-
</div>
|
833
|
-
|
834
|
-
<div id="class-list">
|
835
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
836
|
-
|
837
|
-
Class <a href="Component/OnAnswer.html" class="link">Wee::Component::OnAnswer</a><br />
|
838
|
-
|
839
|
-
</div>
|
840
|
-
|
841
|
-
|
433
|
+
<div id="method-M000050" class="method-detail">
|
434
|
+
<a name="M000050"></a>
|
842
435
|
|
436
|
+
<div class="method-heading">
|
843
437
|
|
844
|
-
|
438
|
+
<a href="#M000050" class="method-signature">
|
845
439
|
|
440
|
+
<span class="method-name">each_child</span><span class="method-args">(&block)</span>
|
846
441
|
|
847
|
-
<!-- if method_list -->
|
848
|
-
<div id="methods">
|
849
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
850
|
-
|
851
|
-
<div id="method-M000341" class="method-detail">
|
852
|
-
<a name="M000341"></a>
|
853
|
-
|
854
|
-
<div class="method-heading">
|
855
|
-
<a href="#M000341" class="method-signature">
|
856
|
-
<span class="method-name">answer</span><span class="method-args">(*args)</span>
|
857
442
|
</a>
|
858
|
-
</div>
|
859
|
-
|
860
|
-
<div class="method-description">
|
861
|
-
<p>
|
862
|
-
Return from a called component.
|
863
|
-
</p>
|
864
|
-
<p>
|
865
|
-
NOTE that <a href="Component.html#M000341">answer</a> never returns.
|
866
|
-
</p>
|
867
|
-
<p>
|
868
|
-
See <a href="Component.html#M000340">call</a> for a detailed description of
|
869
|
-
the call/answer mechanism.
|
870
|
-
</p>
|
871
|
-
<p><a class="source-toggle" href="#"
|
872
|
-
onclick="toggleCode('M000341-source');return false;">[Source]</a></p>
|
873
|
-
<div class="method-source-code" id="M000341-source">
|
874
|
-
<pre>
|
875
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 352</span>
|
876
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">answer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
877
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_answer</span>, <span class="ruby-identifier">args</span>
|
878
|
-
<span class="ruby-keyword kw">end</span>
|
879
|
-
</pre>
|
880
|
-
</div>
|
881
|
-
</div>
|
882
|
-
</div>
|
883
|
-
|
884
|
-
<div id="method-M000340" class="method-detail">
|
885
|
-
<a name="M000340"></a>
|
886
443
|
|
887
|
-
<div class="method-heading">
|
888
|
-
<a href="#M000340" class="method-signature">
|
889
|
-
<span class="method-name">call</span><span class="method-args">(component, return_callback=nil, *args)</span>
|
890
|
-
</a>
|
891
444
|
</div>
|
892
|
-
|
445
|
+
|
893
446
|
<div class="method-description">
|
447
|
+
|
894
448
|
<p>
|
895
|
-
|
896
|
-
it’s callbacks processed until the called component answers using
|
897
|
-
method <a href="Component.html#M000341">answer</a>.
|
449
|
+
Iterates over all direct child components.
|
898
450
|
</p>
|
899
|
-
<dl>
|
900
|
-
<dt><tt>component</tt></dt><dd>The component to be called.
|
901
|
-
|
902
|
-
</dd>
|
903
|
-
<dt><tt>return_callback</tt></dt><dd>Is invoked when the called component answers. Either a symbol or any object
|
904
|
-
that responds to <a href="Component.html#M000340">call</a>. If it’s a
|
905
|
-
symbol, then the corresponding method of the current component will be
|
906
|
-
called.
|
907
|
-
|
908
|
-
</dd>
|
909
|
-
<dt><tt>args</tt></dt><dd>Arguments that are passed to the <tt>return_callback</tt> before the
|
910
|
-
‘onanswer’ arguments.
|
911
451
|
|
912
|
-
</dd>
|
913
|
-
</dl>
|
914
|
-
<p>
|
915
|
-
<b>How it works</b>
|
916
|
-
</p>
|
917
|
-
<p>
|
918
|
-
The component to be called is wrapped with an <a
|
919
|
-
href="AnswerDecoration.html">AnswerDecoration</a> and the
|
920
|
-
<tt>return_callback</tt> parameter is assigned to it’s
|
921
|
-
<tt>on_answer</tt> attribute (not directly as there are cleanup actions to
|
922
|
-
be taken before the <tt>return_callback</tt> can be invoked, hence we wrap
|
923
|
-
it in the <a href="Component/OnAnswer.html">OnAnswer</a> class). Then a <a
|
924
|
-
href="Delegate.html">Delegate</a> decoration is added to the calling
|
925
|
-
component (self), which delegates to the component to be called
|
926
|
-
(<tt>component</tt>).
|
927
|
-
</p>
|
928
|
-
<p>
|
929
|
-
Then we unwind the calling stack back to the <a
|
930
|
-
href="Session.html">Session</a> by throwing
|
931
|
-
<em>:wee_abort_callback_processing</em>. This means, that there is only
|
932
|
-
ever one action callback invoked per request. This is not neccessary, we
|
933
|
-
could simply omit this, but then we’d break compatibility with the
|
934
|
-
implementation using continuations.
|
935
|
-
</p>
|
936
|
-
<p>
|
937
|
-
When at a later point in time the called component invokes <a
|
938
|
-
href="Component.html#M000341">answer</a>, this will throw a
|
939
|
-
<em>:wee_answer</em> exception which is catched in the <a
|
940
|
-
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
941
|
-
href="AnswerDecoration.html">AnswerDecoration</a> then invokes the
|
942
|
-
<tt>on_answer</tt> callback which cleans up the decorations we added during
|
943
|
-
<a href="Component.html#M000340">call</a>, and finally passes control to
|
944
|
-
the <tt>return_callback</tt>.
|
945
|
-
</p>
|
946
452
|
<p><a class="source-toggle" href="#"
|
947
|
-
onclick="toggleCode('
|
948
|
-
<div class="method-source-code" id="
|
453
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
454
|
+
<div class="method-source-code" id="M000050-source">
|
949
455
|
<pre>
|
950
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
951
|
-
|
952
|
-
|
953
|
-
<span class="ruby-
|
954
|
-
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-constant">OnAnswer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">delegate</span>, <span class="ruby-identifier">answer</span>,
|
955
|
-
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">args</span>)
|
956
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
957
|
-
<span class="ruby-keyword kw">end</span>
|
456
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 108</span>
|
457
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_child</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
458
|
+
<span class="ruby-ivar">@children</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@children</span>
|
459
|
+
<span class="ruby-keyword kw">end</span>
|
958
460
|
</pre>
|
959
461
|
</div>
|
462
|
+
|
960
463
|
</div>
|
961
464
|
</div>
|
962
465
|
|
963
466
|
|
964
|
-
|
965
|
-
|
966
|
-
<h2 class="section-title"><a name="SEC00161">Call/Answer</a></h2>
|
967
|
-
<div class="section-comment">
|
968
|
-
|
969
|
-
</div>
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
467
|
+
<div id="method-M000044" class="method-detail">
|
468
|
+
<a name="M000044"></a>
|
976
469
|
|
470
|
+
<div class="method-heading">
|
977
471
|
|
978
|
-
|
979
|
-
<div id="methods">
|
980
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
472
|
+
<a href="#M000044" class="method-signature">
|
981
473
|
|
982
|
-
|
983
|
-
<a name="M000342"></a>
|
474
|
+
<span class="method-name">initialize</span><span class="method-args">()</span>
|
984
475
|
|
985
|
-
<div class="method-heading">
|
986
|
-
<a href="#M000342" class="method-signature">
|
987
|
-
<span class="method-name">call</span><span class="method-args">(component, return_callback=:use_continuation, *additional_args)</span>
|
988
476
|
</a>
|
477
|
+
|
989
478
|
</div>
|
990
|
-
|
479
|
+
|
991
480
|
<div class="method-description">
|
992
|
-
<p>
|
993
|
-
Call another component. The calling component is neither rendered nor are
|
994
|
-
it’s callbacks processed until the called component answers using
|
995
|
-
method <a href="Component.html#M000341">answer</a>.
|
996
|
-
</p>
|
997
|
-
<dl>
|
998
|
-
<dt><tt>component</tt></dt><dd>The component to be called.
|
999
481
|
|
1000
|
-
|
1001
|
-
|
1002
|
-
<p>
|
1003
|
-
<b>How it works</b>
|
1004
|
-
</p>
|
1005
|
-
<p>
|
1006
|
-
At first a continuation is created. The component to be called is then
|
1007
|
-
wrapped with an <a href="AnswerDecoration.html">AnswerDecoration</a> and
|
1008
|
-
the continuation is assigned to it’s <tt>on_answer</tt> attribute.
|
1009
|
-
Then a <a href="Delegate.html">Delegate</a> decoration is added to the
|
1010
|
-
calling component (self), which delegates to the component to be called
|
1011
|
-
(<tt>component</tt>). Then we unwind the calling stack back to the <a
|
1012
|
-
href="Session.html">Session</a> by throwing
|
1013
|
-
<em>:wee_abort_callback_processing</em>. This means, that there is only
|
1014
|
-
ever one action callback invoked per request. When at a later point in time
|
1015
|
-
the called component invokes <a href="Component.html#M000341">answer</a>,
|
1016
|
-
this will throw a <em>:wee_answer</em> exception which is catched in the <a
|
1017
|
-
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
1018
|
-
href="AnswerDecoration.html">AnswerDecoration</a> then jumps back to the
|
1019
|
-
continuation we created at the beginning, and finally method <a
|
1020
|
-
href="Component.html#M000340">call</a> returns.
|
482
|
+
<p>
|
483
|
+
Initializes a newly created component.
|
1021
484
|
</p>
|
1022
485
|
<p>
|
1023
|
-
|
1024
|
-
|
1025
|
-
<em>:wee_abort_callback_processing</em> after invoking an action callback,
|
1026
|
-
and that’s why only ever one is invoked. We could remove this
|
1027
|
-
limitation without problems, but then there would be a difference between
|
1028
|
-
those action callbacks that call other components and those that do not.
|
486
|
+
Call this method from your own components’ <em>initialize</em> method
|
487
|
+
using <tt>super</tt>, before setting up anything else!
|
1029
488
|
</p>
|
489
|
+
|
1030
490
|
<p><a class="source-toggle" href="#"
|
1031
|
-
onclick="toggleCode('
|
1032
|
-
<div class="method-source-code" id="
|
491
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
492
|
+
<div class="method-source-code" id="M000044-source">
|
1033
493
|
<pre>
|
1034
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">return_callback</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:use_continuation</span>
|
1040
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">callcc</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">cc</span><span class="ruby-operator">|</span>
|
1041
|
-
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-identifier">cc</span>
|
1042
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
1043
|
-
}
|
1044
|
-
<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">delegate</span>)
|
1045
|
-
<span class="ruby-identifier">component</span>.<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">answer</span>)
|
1046
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
1047
|
-
<span class="ruby-keyword kw">else</span>
|
1048
|
-
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-constant">OnAnswer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">delegate</span>, <span class="ruby-identifier">answer</span>,
|
1049
|
-
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">additional_args</span>)
|
1050
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
494
|
+
<span class="ruby-comment cmt"># File lib/wee/component.rb, line 19</span>
|
495
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>() <span class="ruby-comment cmt"># :notnew:</span>
|
496
|
+
<span class="ruby-ivar">@decoration</span> = <span class="ruby-keyword kw">self</span>
|
497
|
+
<span class="ruby-ivar">@children</span> = <span class="ruby-keyword kw">nil</span>
|
1051
498
|
<span class="ruby-keyword kw">end</span>
|
1052
|
-
<span class="ruby-keyword kw">end</span>
|
1053
499
|
</pre>
|
1054
500
|
</div>
|
501
|
+
|
1055
502
|
</div>
|
1056
503
|
</div>
|
1057
504
|
|
1058
505
|
|
506
|
+
|
1059
507
|
</div>
|
1060
508
|
|
1061
509
|
|
1062
|
-
</div>
|
1063
510
|
|
1064
511
|
|
512
|
+
</div>
|
513
|
+
|
1065
514
|
<div id="validator-badges">
|
1066
515
|
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1067
516
|
</div>
|
1068
517
|
|
1069
518
|
</body>
|
1070
|
-
</html>
|
519
|
+
</html>
|