waves 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/waves +17 -72
- data/doc/HISTORY +1 -44
- data/doc/README +1 -0
- data/doc/VERSION +1 -0
- data/lib/caches/file.rb +48 -0
- data/lib/caches/memcached.rb +40 -0
- data/lib/caches/simple.rb +25 -0
- data/lib/caches/synchronized.rb +25 -0
- data/lib/commands/console.rb +35 -0
- data/lib/commands/generate.rb +52 -0
- data/lib/commands/help.rb +5 -0
- data/lib/commands/{waves-server.rb → server.rb} +16 -3
- data/lib/dispatchers/base.rb +21 -20
- data/lib/dispatchers/default.rb +11 -63
- data/lib/ext/float.rb +13 -0
- data/lib/{utilities → ext}/hash.rb +2 -2
- data/lib/{utilities → ext}/integer.rb +5 -2
- data/lib/ext/kernel.rb +20 -0
- data/lib/ext/module.rb +20 -0
- data/lib/{utilities → ext}/object.rb +3 -5
- data/lib/ext/string.rb +20 -0
- data/lib/ext/symbol.rb +11 -0
- data/lib/ext/tempfile.rb +5 -0
- data/lib/foundations/classic.rb +64 -0
- data/lib/foundations/compact.rb +50 -0
- data/lib/helpers/basic.rb +11 -0
- data/lib/helpers/doc_type.rb +34 -0
- data/lib/helpers/extended.rb +21 -0
- data/lib/helpers/form.rb +3 -1
- data/lib/helpers/formatting.rb +3 -3
- data/lib/helpers/layouts.rb +37 -0
- data/lib/helpers/model.rb +8 -4
- data/lib/helpers/view.rb +2 -4
- data/lib/layers/inflect/english.rb +48 -5
- data/lib/layers/mvc.rb +18 -18
- data/lib/layers/mvc/controllers.rb +41 -0
- data/lib/layers/mvc/extensions.rb +52 -0
- data/lib/layers/orm/{active_record.rb → providers/active_record.rb} +9 -14
- data/lib/layers/orm/{active_record → providers/active_record}/migrations/empty.rb.erb +0 -0
- data/lib/layers/orm/{active_record → providers/active_record}/tasks/generate.rb +1 -1
- data/lib/layers/orm/{active_record → providers/active_record}/tasks/schema.rb +1 -1
- data/lib/layers/orm/{data_mapper.rb → providers/data_mapper.rb} +3 -4
- data/lib/layers/orm/providers/filebase.rb +25 -0
- data/lib/layers/orm/{sequel.rb → providers/sequel.rb} +11 -7
- data/lib/layers/orm/{sequel → providers/sequel}/migrations/empty.rb.erb +0 -0
- data/lib/layers/orm/{sequel → providers/sequel}/tasks/generate.rb +5 -3
- data/lib/layers/orm/{sequel → providers/sequel}/tasks/schema.rb +2 -2
- data/lib/{renderers → layers/renderers}/erubis.rb +10 -13
- data/lib/{renderers → layers/renderers}/haml.rb +27 -25
- data/lib/layers/renderers/markaby.rb +29 -0
- data/lib/matchers/accept.rb +21 -0
- data/lib/matchers/base.rb +30 -0
- data/lib/matchers/content_type.rb +17 -0
- data/lib/matchers/path.rb +67 -0
- data/lib/matchers/query.rb +21 -0
- data/lib/matchers/request.rb +27 -0
- data/lib/matchers/resource.rb +19 -0
- data/lib/matchers/traits.rb +19 -0
- data/lib/matchers/uri.rb +20 -0
- data/lib/renderers/mixin.rb +15 -29
- data/lib/resources/mixin.rb +132 -0
- data/lib/resources/paths.rb +34 -0
- data/lib/runtime/configuration.rb +55 -135
- data/lib/runtime/console.rb +4 -1
- data/lib/runtime/logger.rb +24 -48
- data/lib/runtime/mime_types.rb +516 -2
- data/lib/runtime/mocks.rb +14 -0
- data/lib/runtime/monitor.rb +32 -0
- data/lib/runtime/request.rb +107 -39
- data/lib/runtime/response.rb +5 -2
- data/lib/runtime/response_mixin.rb +43 -22
- data/lib/runtime/runtime.rb +67 -0
- data/lib/runtime/server.rb +14 -101
- data/lib/runtime/session.rb +4 -43
- data/lib/runtime/worker.rb +86 -0
- data/lib/servers/base.rb +42 -0
- data/lib/servers/mongrel.rb +13 -0
- data/lib/servers/webrick.rb +13 -0
- data/lib/tasks/gem.rb +1 -0
- data/lib/tasks/generate.rb +67 -62
- data/lib/views/errors.rb +49 -0
- data/lib/views/mixin.rb +34 -82
- data/lib/waves.rb +36 -57
- data/samples/blog/Rakefile +16 -5
- data/samples/blog/blog.db +0 -0
- data/samples/blog/configurations/default.rb +11 -0
- data/samples/blog/configurations/development.rb +9 -11
- data/samples/blog/configurations/production.rb +11 -15
- data/samples/blog/log/waves.production +3 -0
- data/samples/blog/models/comment.rb +9 -0
- data/samples/blog/models/entry.rb +17 -0
- data/samples/blog/public/css/site.css +13 -2
- data/samples/blog/public/javascript/jquery-1.2.6.min.js +32 -0
- data/samples/blog/resources/entry.rb +39 -0
- data/samples/blog/resources/map.rb +9 -0
- data/samples/blog/schema/migrations/001_initial_schema.rb +3 -3
- data/samples/blog/schema/migrations/002_add_comments.rb +2 -2
- data/samples/blog/startup.rb +8 -6
- data/samples/blog/templates/comment/add.mab +6 -4
- data/samples/blog/templates/comment/list.mab +4 -4
- data/samples/blog/templates/entry/{editor.mab → edit.mab} +7 -6
- data/samples/blog/templates/entry/list.mab +10 -5
- data/samples/blog/templates/entry/show.mab +16 -7
- data/samples/blog/templates/entry/summary.mab +8 -4
- data/samples/blog/templates/errors/not_found_404.mab +6 -1
- data/samples/blog/templates/layouts/default.mab +5 -3
- data/samples/blog/templates/waves/status.mab +85 -0
- data/{app → templates/classic}/Rakefile +58 -0
- data/templates/classic/configurations/default.rb.erb +9 -0
- data/{app → templates/classic}/configurations/development.rb.erb +3 -8
- data/{app → templates/classic}/configurations/production.rb.erb +3 -5
- data/templates/classic/resources/map.rb.erb +8 -0
- data/templates/classic/startup.rb.erb +11 -0
- data/{app → templates/classic}/templates/errors/not_found_404.mab +0 -0
- data/{app → templates/classic}/templates/errors/server_error_500.mab +0 -0
- data/{app → templates/classic}/templates/layouts/default.mab +0 -0
- data/templates/compact/startup.rb.erb +11 -0
- metadata +257 -610
- data/app/bin/waves-console +0 -4
- data/app/bin/waves-server +0 -4
- data/app/configurations/mapping.rb.erb +0 -14
- data/app/controllers/.gitignore +0 -0
- data/app/doc/.gitignore +0 -0
- data/app/helpers/.gitignore +0 -0
- data/app/lib/application.rb.erb +0 -5
- data/app/lib/tasks/.gitignore +0 -0
- data/app/log/.gitignore +0 -0
- data/app/models/.gitignore +0 -0
- data/app/public/css/.gitignore +0 -0
- data/app/public/flash/.gitignore +0 -0
- data/app/public/images/.gitignore +0 -0
- data/app/public/javascript/.gitignore +0 -0
- data/app/schema/migrations/.gitignore +0 -0
- data/app/startup.rb +0 -5
- data/app/tmp/sessions/.gitignore +0 -0
- data/app/views/.gitignore +0 -0
- data/bin/waves-console +0 -4
- data/bin/waves-server +0 -4
- data/doc/rdoc/classes/Erubis/Context.html +0 -218
- data/doc/rdoc/classes/Kernel.html +0 -145
- data/doc/rdoc/classes/Symbol.html +0 -154
- data/doc/rdoc/classes/Tempfile.html +0 -161
- data/doc/rdoc/classes/Waves.html +0 -455
- data/doc/rdoc/classes/Waves/Application.html +0 -371
- data/doc/rdoc/classes/Waves/Blackboard.html +0 -296
- data/doc/rdoc/classes/Waves/Configurations.html +0 -283
- data/doc/rdoc/classes/Waves/Configurations/Base.html +0 -209
- data/doc/rdoc/classes/Waves/Configurations/Default.html +0 -237
- data/doc/rdoc/classes/Waves/Console.html +0 -187
- data/doc/rdoc/classes/Waves/Controllers.html +0 -203
- data/doc/rdoc/classes/Waves/Controllers/Base.html +0 -151
- data/doc/rdoc/classes/Waves/Controllers/Mixin.html +0 -312
- data/doc/rdoc/classes/Waves/Dispatchers.html +0 -118
- data/doc/rdoc/classes/Waves/Dispatchers/Base.html +0 -198
- data/doc/rdoc/classes/Waves/Dispatchers/Default.html +0 -224
- data/doc/rdoc/classes/Waves/Dispatchers/NotFoundError.html +0 -122
- data/doc/rdoc/classes/Waves/Dispatchers/Redirect.html +0 -173
- data/doc/rdoc/classes/Waves/Foundations.html +0 -131
- data/doc/rdoc/classes/Waves/Foundations/Default.html +0 -179
- data/doc/rdoc/classes/Waves/Foundations/Simple.html +0 -167
- data/doc/rdoc/classes/Waves/Helpers.html +0 -176
- data/doc/rdoc/classes/Waves/Helpers/AssetHelper.html +0 -212
- data/doc/rdoc/classes/Waves/Helpers/Common.html +0 -213
- data/doc/rdoc/classes/Waves/Helpers/Default.html +0 -135
- data/doc/rdoc/classes/Waves/Helpers/Form.html +0 -201
- data/doc/rdoc/classes/Waves/Helpers/Formatting.html +0 -232
- data/doc/rdoc/classes/Waves/Helpers/Model.html +0 -194
- data/doc/rdoc/classes/Waves/Helpers/NumberHelper.html +0 -165
- data/doc/rdoc/classes/Waves/Helpers/TagHelper.html +0 -226
- data/doc/rdoc/classes/Waves/Helpers/UrlHelper.html +0 -242
- data/doc/rdoc/classes/Waves/Helpers/View.html +0 -163
- data/doc/rdoc/classes/Waves/Inflect/InflectorMethods.html +0 -475
- data/doc/rdoc/classes/Waves/Layers.html +0 -175
- data/doc/rdoc/classes/Waves/Layers/DefaultErrors.html +0 -161
- data/doc/rdoc/classes/Waves/Layers/Inflect.html +0 -119
- data/doc/rdoc/classes/Waves/Layers/Inflect/English.html +0 -168
- data/doc/rdoc/classes/Waves/Layers/Inflect/English/Rules.html +0 -112
- data/doc/rdoc/classes/Waves/Layers/Inflect/English/StringMethods.html +0 -194
- data/doc/rdoc/classes/Waves/Layers/MVC.html +0 -204
- data/doc/rdoc/classes/Waves/Layers/ORM/ActiveRecord.html +0 -239
- data/doc/rdoc/classes/Waves/Layers/ORM/ActiveRecord/ControllerMethods.html +0 -246
- data/doc/rdoc/classes/Waves/Layers/ORM/ActiveRecord/Symbol.html +0 -132
- data/doc/rdoc/classes/Waves/Layers/ORM/DataMapper.html +0 -166
- data/doc/rdoc/classes/Waves/Layers/ORM/Filebase.html +0 -157
- data/doc/rdoc/classes/Waves/Layers/ORM/Sequel.html +0 -232
- data/doc/rdoc/classes/Waves/Layers/ORM/Sequel/ControllerMethods.html +0 -246
- data/doc/rdoc/classes/Waves/Layers/Simple.html +0 -169
- data/doc/rdoc/classes/Waves/Layers/SimpleErrors.html +0 -159
- data/doc/rdoc/classes/Waves/Logger.html +0 -288
- data/doc/rdoc/classes/Waves/Mapping.html +0 -760
- data/doc/rdoc/classes/Waves/Mapping/PrettyUrls.html +0 -129
- data/doc/rdoc/classes/Waves/Mapping/PrettyUrls/GetRules.html +0 -174
- data/doc/rdoc/classes/Waves/Mapping/PrettyUrls/RestRules.html +0 -180
- data/doc/rdoc/classes/Waves/MimeTypes.html +0 -200
- data/doc/rdoc/classes/Waves/Renderers/Erubis.html +0 -162
- data/doc/rdoc/classes/Waves/Renderers/Haml.html +0 -160
- data/doc/rdoc/classes/Waves/Renderers/Markaby.html +0 -167
- data/doc/rdoc/classes/Waves/Renderers/Mixin.html +0 -191
- data/doc/rdoc/classes/Waves/Renderers/Scope.html +0 -181
- data/doc/rdoc/classes/Waves/Request.html +0 -441
- data/doc/rdoc/classes/Waves/Request/ParseError.html +0 -111
- data/doc/rdoc/classes/Waves/Response.html +0 -283
- data/doc/rdoc/classes/Waves/ResponseMixin.html +0 -460
- data/doc/rdoc/classes/Waves/ResponseProxy.html +0 -269
- data/doc/rdoc/classes/Waves/Server.html +0 -488
- data/doc/rdoc/classes/Waves/Session.html +0 -330
- data/doc/rdoc/classes/Waves/Utilities/Hash.html +0 -185
- data/doc/rdoc/classes/Waves/Utilities/Integer.html +0 -424
- data/doc/rdoc/classes/Waves/Utilities/Module.html +0 -174
- data/doc/rdoc/classes/Waves/Utilities/Object.html +0 -155
- data/doc/rdoc/classes/Waves/Utilities/Proc.html +0 -145
- data/doc/rdoc/classes/Waves/Utilities/String.html +0 -290
- data/doc/rdoc/classes/Waves/Views.html +0 -278
- data/doc/rdoc/classes/Waves/Views/Base.html +0 -118
- data/doc/rdoc/classes/Waves/Views/Mixin.html +0 -279
- data/doc/rdoc/classes/Waves/Views/NoTemplateError.html +0 -111
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/README_rdoc.html +0 -415
- data/doc/rdoc/files/bin/waves.html +0 -135
- data/doc/rdoc/files/doc/HISTORY.html +0 -265
- data/doc/rdoc/files/lib/commands/waves-console_rb.html +0 -110
- data/doc/rdoc/files/lib/commands/waves-server_rb.html +0 -108
- data/doc/rdoc/files/lib/controllers/base_rb.html +0 -101
- data/doc/rdoc/files/lib/controllers/mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/dispatchers/base_rb.html +0 -101
- data/doc/rdoc/files/lib/dispatchers/default_rb.html +0 -101
- data/doc/rdoc/files/lib/foundations/default_rb.html +0 -101
- data/doc/rdoc/files/lib/foundations/simple_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/asset_helper_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/common_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/default_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/form_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/formatting_rb.html +0 -108
- data/doc/rdoc/files/lib/helpers/model_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/number_helper_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/tag_helper_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/url_helper_rb.html +0 -101
- data/doc/rdoc/files/lib/helpers/view_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/default_errors_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/inflect/english/rules_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/inflect/english/string_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/inflect/english_rb.html +0 -109
- data/doc/rdoc/files/lib/layers/mvc_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/active_record/tasks/generate_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/active_record/tasks/schema_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/active_record_rb.html +0 -108
- data/doc/rdoc/files/lib/layers/orm/data_mapper_rb.html +0 -108
- data/doc/rdoc/files/lib/layers/orm/filebase_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/migration_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/sequel/tasks/generate_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/sequel/tasks/schema_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/orm/sequel_rb.html +0 -108
- data/doc/rdoc/files/lib/layers/simple_errors_rb.html +0 -101
- data/doc/rdoc/files/lib/layers/simple_rb.html +0 -101
- data/doc/rdoc/files/lib/mapping/mapping_rb.html +0 -101
- data/doc/rdoc/files/lib/mapping/pretty_urls_rb.html +0 -101
- data/doc/rdoc/files/lib/renderers/erubis_rb.html +0 -108
- data/doc/rdoc/files/lib/renderers/haml_rb.html +0 -108
- data/doc/rdoc/files/lib/renderers/markaby_rb.html +0 -108
- data/doc/rdoc/files/lib/renderers/mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/application_rb.html +0 -107
- data/doc/rdoc/files/lib/runtime/blackboard_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/configuration_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/console_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/debugger_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/logger_rb.html +0 -108
- data/doc/rdoc/files/lib/runtime/mime_types_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/request_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/response_mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/response_proxy_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/response_rb.html +0 -101
- data/doc/rdoc/files/lib/runtime/server_rb.html +0 -108
- data/doc/rdoc/files/lib/runtime/session_rb.html +0 -101
- data/doc/rdoc/files/lib/tasks/cluster_rb.html +0 -101
- data/doc/rdoc/files/lib/tasks/gem_rb.html +0 -108
- data/doc/rdoc/files/lib/tasks/generate_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/hash_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/inflect_rb.html +0 -111
- data/doc/rdoc/files/lib/utilities/integer_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/module_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/object_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/proc_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/string_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/symbol_rb.html +0 -101
- data/doc/rdoc/files/lib/utilities/tempfile_rb.html +0 -115
- data/doc/rdoc/files/lib/views/base_rb.html +0 -101
- data/doc/rdoc/files/lib/views/mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/waves_rb.html +0 -195
- data/doc/rdoc/fr_class_index.html +0 -104
- data/doc/rdoc/fr_file_index.html +0 -97
- data/doc/rdoc/fr_method_index.html +0 -233
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/lib/commands/waves-console.rb +0 -21
- data/lib/controllers/base.rb +0 -11
- data/lib/controllers/mixin.rb +0 -165
- data/lib/foundations/default.rb +0 -27
- data/lib/foundations/simple.rb +0 -30
- data/lib/helpers/asset_helper.rb +0 -67
- data/lib/helpers/common.rb +0 -66
- data/lib/helpers/default.rb +0 -13
- data/lib/helpers/number_helper.rb +0 -25
- data/lib/helpers/tag_helper.rb +0 -58
- data/lib/helpers/url_helper.rb +0 -77
- data/lib/layers/default_errors.rb +0 -26
- data/lib/layers/inflect/english/rules.rb +0 -88
- data/lib/layers/inflect/english/string.rb +0 -24
- data/lib/layers/orm/filebase.rb +0 -22
- data/lib/layers/simple.rb +0 -32
- data/lib/layers/simple_errors.rb +0 -23
- data/lib/mapping/mapping.rb +0 -289
- data/lib/mapping/pretty_urls.rb +0 -96
- data/lib/renderers/markaby.rb +0 -33
- data/lib/runtime/application.rb +0 -69
- data/lib/runtime/blackboard.rb +0 -57
- data/lib/runtime/debugger.rb +0 -9
- data/lib/runtime/response_proxy.rb +0 -30
- data/lib/tasks/cluster.rb +0 -26
- data/lib/utilities/inflect.rb +0 -110
- data/lib/utilities/module.rb +0 -21
- data/lib/utilities/proc.rb +0 -16
- data/lib/utilities/string.rb +0 -49
- data/lib/utilities/symbol.rb +0 -10
- data/lib/utilities/tempfile.rb +0 -9
- data/lib/views/base.rb +0 -9
- data/samples/blog/bin/waves-console +0 -3
- data/samples/blog/bin/waves-server +0 -3
- data/samples/blog/configurations/mapping.rb +0 -23
- data/samples/blog/doc/EMTPY +0 -0
- data/samples/blog/lib/application.rb +0 -5
- data/samples/jub/Rakefile +0 -72
- data/samples/jub/bin/waves-console +0 -4
- data/samples/jub/bin/waves-server +0 -4
- data/samples/jub/configurations/development.rb +0 -31
- data/samples/jub/configurations/mapping.rb +0 -18
- data/samples/jub/configurations/production.rb +0 -31
- data/samples/jub/lib/application.rb +0 -5
- data/samples/jub/startup.rb +0 -6
- data/samples/jub/templates/errors/not_found_404.mab +0 -2
- data/samples/jub/templates/errors/server_error_500.mab +0 -2
- data/samples/jub/templates/layouts/default.mab +0 -14
- data/verify/app_generation/helpers.rb +0 -24
- data/verify/app_generation/startup.rb +0 -39
- data/verify/blackboard/blackboard_verify.rb +0 -92
- data/verify/blackboard/helpers.rb +0 -5
- data/verify/configurations/attributes.rb +0 -37
- data/verify/configurations/helpers.rb +0 -1
- data/verify/configurations/rack_integration.rb +0 -29
- data/verify/controllers/base.rb +0 -37
- data/verify/controllers/helpers.rb +0 -13
- data/verify/controllers/interface.rb +0 -51
- data/verify/core/helpers.rb +0 -3
- data/verify/core/utilities.rb +0 -177
- data/verify/foundations/default.rb +0 -86
- data/verify/foundations/default_application/Rakefile +0 -14
- data/verify/foundations/default_application/bin/waves-console +0 -3
- data/verify/foundations/default_application/bin/waves-server +0 -3
- data/verify/foundations/default_application/configurations/development.rb +0 -26
- data/verify/foundations/default_application/configurations/mapping.rb +0 -14
- data/verify/foundations/default_application/configurations/production.rb +0 -30
- data/verify/foundations/default_application/controllers/default.rb +0 -15
- data/verify/foundations/default_application/controllers/loaded.rb +0 -15
- data/verify/foundations/default_application/defaultapplication.db +0 -0
- data/verify/foundations/default_application/helpers/loaded.rb +0 -10
- data/verify/foundations/default_application/lib/application.rb +0 -5
- data/verify/foundations/default_application/models/default.rb +0 -13
- data/verify/foundations/default_application/models/loaded.rb +0 -13
- data/verify/foundations/default_application/schema/migrations/templates/empty.rb.erb +0 -9
- data/verify/foundations/default_application/startup.rb +0 -7
- data/verify/foundations/default_application/templates/errors/not_found_404.mab +0 -2
- data/verify/foundations/default_application/templates/errors/server_error_500.mab +0 -2
- data/verify/foundations/default_application/templates/layouts/default.mab +0 -14
- data/verify/foundations/default_application/views/default.rb +0 -7
- data/verify/foundations/default_application/views/loaded.rb +0 -15
- data/verify/foundations/helpers.rb +0 -1
- data/verify/foundations/simple.rb +0 -25
- data/verify/helpers.rb +0 -76
- data/verify/layers/data_mapper/association_verify.rb +0 -87
- data/verify/layers/default_errors.rb +0 -29
- data/verify/layers/helpers.rb +0 -1
- data/verify/layers/migration.rb +0 -33
- data/verify/layers/sequel/model.rb +0 -41
- data/verify/layers/sequeltest.db +0 -0
- data/verify/mapping/always.rb +0 -19
- data/verify/mapping/filters.rb +0 -65
- data/verify/mapping/handle.rb +0 -24
- data/verify/mapping/helpers.rb +0 -7
- data/verify/mapping/matches.rb +0 -27
- data/verify/mapping/named.rb +0 -29
- data/verify/mapping/options.rb +0 -17
- data/verify/mapping/path.rb +0 -40
- data/verify/mapping/response_proxy.rb +0 -50
- data/verify/mapping/threaded.rb +0 -25
- data/verify/requests/helpers.rb +0 -16
- data/verify/requests/request.rb +0 -73
- data/verify/requests/response.rb +0 -59
- data/verify/requests/session.rb +0 -54
- data/verify/views/helpers.rb +0 -1
- data/verify/views/rendering.rb +0 -34
- data/verify/views/templates/foo.erb +0 -0
- data/verify/views/templates/moo.erb +0 -0
- data/verify/views/templates/moo.mab +0 -0
@@ -1,760 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: Waves::Mapping</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Waves::Mapping</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/mapping/mapping_rb.html">
|
59
|
-
lib/mapping/mapping.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../../files/lib/mapping/pretty_urls_rb.html">
|
63
|
-
lib/mapping/pretty_urls.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
</td>
|
67
|
-
</tr>
|
68
|
-
|
69
|
-
</table>
|
70
|
-
</div>
|
71
|
-
<!-- banner header -->
|
72
|
-
|
73
|
-
<div id="bodyContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
<div id="contextContent">
|
78
|
-
|
79
|
-
<div id="description">
|
80
|
-
<p>
|
81
|
-
Mappings in <a href="../Waves.html">Waves</a> are the interface between the
|
82
|
-
request dispatcher and your application code. The dispatcher matches each
|
83
|
-
request against the mappings to determine a primary action and to collect
|
84
|
-
sets of <a href="Mapping.html#M000028">before</a>, <a
|
85
|
-
href="Mapping.html#M000029">after</a>, <a
|
86
|
-
href="Mapping.html#M000030">wrap</a>, and <a
|
87
|
-
href="Mapping.html#M000031">always</a> actions. The dispatcher also looks
|
88
|
-
for an exception handler registered in the mappings when attempting a
|
89
|
-
rescue.
|
90
|
-
</p>
|
91
|
-
<p>
|
92
|
-
Each mapping associates a block with a set of constraints. Mappings can be
|
93
|
-
one of several types:
|
94
|
-
</p>
|
95
|
-
<ul>
|
96
|
-
<li>action (the actual request processing and response)
|
97
|
-
|
98
|
-
</li>
|
99
|
-
<li><a href="Mapping.html#M000036">handle</a> (exception handling)
|
100
|
-
|
101
|
-
</li>
|
102
|
-
<li><a href="Mapping.html#M000028">before</a>
|
103
|
-
|
104
|
-
</li>
|
105
|
-
<li><a href="Mapping.html#M000029">after</a>
|
106
|
-
|
107
|
-
</li>
|
108
|
-
<li><a href="Mapping.html#M000030">wrap</a> (registers its block as both a <a
|
109
|
-
href="Mapping.html#M000028">before</a> and <a
|
110
|
-
href="Mapping.html#M000029">after</a> action)
|
111
|
-
|
112
|
-
</li>
|
113
|
-
<li><a href="Mapping.html#M000031">always</a> (like an "ensure"
|
114
|
-
clause in a rescue)
|
115
|
-
|
116
|
-
</li>
|
117
|
-
</ul>
|
118
|
-
<p>
|
119
|
-
Actions are registered using <a href="Mapping.html#M000033">path</a>, <a
|
120
|
-
href="Mapping.html#M000034">url</a>, or <a
|
121
|
-
href="Mapping.html#M000032">map</a>. The other types may be registered
|
122
|
-
using methods named <a href="Mapping.html#M000029">after</a> the type.
|
123
|
-
</p>
|
124
|
-
<p>
|
125
|
-
The available constraints are:
|
126
|
-
</p>
|
127
|
-
<ul>
|
128
|
-
<li>a string or regexp that the <a href="Mapping.html#M000033">path</a> or <a
|
129
|
-
href="Mapping.html#M000034">url</a> must match
|
130
|
-
|
131
|
-
</li>
|
132
|
-
<li>parameters to match against the HTTP request headers and the Rack-specific
|
133
|
-
variables (e.g. ‘rack.url_scheme’)
|
134
|
-
|
135
|
-
</li>
|
136
|
-
<li>an additional hash reserved for settings not related to the Rack request
|
137
|
-
(e.g. giving Rack handers special instructions for certain requests. See <a
|
138
|
-
href="Mapping.html#M000038">threaded?</a> )
|
139
|
-
|
140
|
-
</li>
|
141
|
-
</ul>
|
142
|
-
<p>
|
143
|
-
The dispatcher evaluates mapping blocks in an instance of <a
|
144
|
-
href="ResponseProxy.html">ResponseProxy</a>, which provides access to
|
145
|
-
foundational classes of a <a href="../Waves.html">Waves</a> application
|
146
|
-
(i.e. controllers and views)
|
147
|
-
</p>
|
148
|
-
<h2>Examples</h2>
|
149
|
-
<pre>
|
150
|
-
resource = '([\w\-]+)'
|
151
|
-
name = '([\w\-\_\.\+\@]+)'
|
152
|
-
|
153
|
-
path %r{^/#{resource}/#{name}/?$} do |resource, name|
|
154
|
-
"Hello from a #{resource} named #{name.capitalize}."
|
155
|
-
end
|
156
|
-
</pre>
|
157
|
-
<p>
|
158
|
-
In this example, we are using binding regular expressions defined by
|
159
|
-
<tt>resource</tt> and <tt>name</tt>. The matches are passed into the block
|
160
|
-
as parameters. Thus, this rule, given the URL ’/person/john’
|
161
|
-
will return:
|
162
|
-
</p>
|
163
|
-
<pre>
|
164
|
-
Hello from a person named John.
|
165
|
-
</pre>
|
166
|
-
<p>
|
167
|
-
The given block may simple return a string. The content type is inferred
|
168
|
-
from the request if possible, otherwise it defaults to
|
169
|
-
<tt>text</tt>/<tt>html</tt>.
|
170
|
-
</p>
|
171
|
-
<pre>
|
172
|
-
path '/critters', :method => :post do
|
173
|
-
request.content_type
|
174
|
-
end
|
175
|
-
|
176
|
-
/critters # => 'text/html'
|
177
|
-
</pre>
|
178
|
-
<p>
|
179
|
-
In this example, we match against a string and check to make sure that the
|
180
|
-
request is a POST. If so, we return the request content_type. The request
|
181
|
-
(and response) objects are available from within the block implicitly.
|
182
|
-
</p>
|
183
|
-
<h1>Invoking <a href="Controllers.html">Controllers</a> and <a href="Views.html">Views</a></h1>
|
184
|
-
<p>
|
185
|
-
You may invoke a controller or view method for the primary application by
|
186
|
-
using the corresponding methods, preceded by the <tt>use</tt> directive.
|
187
|
-
</p>
|
188
|
-
<h2>Examples</h2>
|
189
|
-
<pre>
|
190
|
-
path %r{^/#{resource}/#{name}/?$} do |resource, name|
|
191
|
-
resource( resource ) do
|
192
|
-
controller { find( name ) } | view { | instance | show( resource => instance ) }
|
193
|
-
end
|
194
|
-
end
|
195
|
-
</pre>
|
196
|
-
<p>
|
197
|
-
In this example, we take the same rule from above but invoke a controller
|
198
|
-
and view method. We use the <tt>resource</tt> directive and the resource
|
199
|
-
parameter to set the MVC instances we‘re going to use. This is
|
200
|
-
necessary to use the <tt>controller</tt> or <tt>view</tt> methods. Each of
|
201
|
-
these take a block as arguments which are evaluated in the context of the
|
202
|
-
instance. The <tt>view</tt> method can further take an argument which is
|
203
|
-
"piped" from the result of the controller block. This isn‘t
|
204
|
-
required, but helps to clarify the request processing. Within a view block,
|
205
|
-
a hash may also be passed in to the view method, which is converted into
|
206
|
-
instance variables for the view instance. In this example, the
|
207
|
-
<tt>show</tt> method is assigned to an instance variable with the same name
|
208
|
-
as the resource type.
|
209
|
-
</p>
|
210
|
-
<p>
|
211
|
-
So given the same URL as above - /person/john - what will happen is the
|
212
|
-
<tt>find</tt> method for the <tt>Person</tt> controller will be invoked and
|
213
|
-
the result passed to the <tt>Person</tt> view‘s <tt>show</tt> method,
|
214
|
-
with +@person+ holding the value returned.
|
215
|
-
</p>
|
216
|
-
<p>
|
217
|
-
Crucially, the controller does not need to know what variables the view
|
218
|
-
depends on. This is the job of the mapping block, to act as the
|
219
|
-
"glue" between the controller and view. The controller and view
|
220
|
-
can thus be completely decoupled and become easier to reuse separately.
|
221
|
-
</p>
|
222
|
-
<pre>
|
223
|
-
url 'http://admin.foobar.com:/' do
|
224
|
-
resource( :admin ) { view { console } }
|
225
|
-
end
|
226
|
-
</pre>
|
227
|
-
<p>
|
228
|
-
In this example, we are using the <tt><a
|
229
|
-
href="Mapping.html#M000034">url</a></tt> method to <a
|
230
|
-
href="Mapping.html#M000032">map</a> a subdomain of +foobar.com+ to the
|
231
|
-
console method of the Admin view. In this case, we did not need a
|
232
|
-
controller method, so we simply didn‘t call one.
|
233
|
-
</p>
|
234
|
-
<h1><a href="Mapping.html">Mapping</a> Modules</h1>
|
235
|
-
<p>
|
236
|
-
You may encapsulate sets of related rules into modules and simply include
|
237
|
-
them into your mapping module. Some rule sets come packaged with <a
|
238
|
-
href="../Waves.html">Waves</a>, such as <a
|
239
|
-
href="Mapping/PrettyUrls.html">PrettyUrls</a> (rules for matching resources
|
240
|
-
using names instead of ids). The simplest way to define such modules for
|
241
|
-
reuse is by defining the <tt>included</tt> class method for the rules
|
242
|
-
module, and then define the rules using <tt>module_eval</tt>. See the <a
|
243
|
-
href="Mapping/PrettyUrls.html">PrettyUrls</a> module for an example of how
|
244
|
-
to do this.
|
245
|
-
</p>
|
246
|
-
<p>
|
247
|
-
*Important:* Using pre-packaged mapping rules does not prevent you from
|
248
|
-
adding to or overriding these rules. However, order does matter, so you
|
249
|
-
should put your own rules ahead of those your may be importing. Also, place
|
250
|
-
rules with constraints (for example, rules that require a POST) ahead of
|
251
|
-
those with no constraints, otherwise the constrainted rules may never be
|
252
|
-
called.
|
253
|
-
</p>
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div id="method-list">
|
261
|
-
<h3 class="section-bar">Methods</h3>
|
262
|
-
|
263
|
-
<div class="name-list">
|
264
|
-
<a href="#M000039">[]</a>
|
265
|
-
<a href="#M000029">after</a>
|
266
|
-
<a href="#M000031">always</a>
|
267
|
-
<a href="#M000028">before</a>
|
268
|
-
<a href="#M000040">clear</a>
|
269
|
-
<a href="#M000036">handle</a>
|
270
|
-
<a href="#M000032">map</a>
|
271
|
-
<a href="#M000033">path</a>
|
272
|
-
<a href="#M000035">root</a>
|
273
|
-
<a href="#M000037">threaded</a>
|
274
|
-
<a href="#M000038">threaded?</a>
|
275
|
-
<a href="#M000034">url</a>
|
276
|
-
<a href="#M000030">wrap</a>
|
277
|
-
</div>
|
278
|
-
</div>
|
279
|
-
|
280
|
-
</div>
|
281
|
-
|
282
|
-
|
283
|
-
<!-- if includes -->
|
284
|
-
|
285
|
-
<div id="section">
|
286
|
-
|
287
|
-
<div id="class-list">
|
288
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
289
|
-
|
290
|
-
Module <a href="Mapping/PrettyUrls.html" class="link">Waves::Mapping::PrettyUrls</a><br />
|
291
|
-
|
292
|
-
</div>
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
<!-- if method_list -->
|
301
|
-
<div id="methods">
|
302
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
303
|
-
|
304
|
-
<div id="method-M000039" class="method-detail">
|
305
|
-
<a name="M000039"></a>
|
306
|
-
|
307
|
-
<div class="method-heading">
|
308
|
-
<a href="#M000039" class="method-signature">
|
309
|
-
<span class="method-name">[]</span><span class="method-args">( request )</span>
|
310
|
-
</a>
|
311
|
-
</div>
|
312
|
-
|
313
|
-
<div class="method-description">
|
314
|
-
<p>
|
315
|
-
Match the given request against the defined rules. This is typically only
|
316
|
-
called by a dispatcher object, so you shouldn‘t typically use it
|
317
|
-
directly.
|
318
|
-
</p>
|
319
|
-
<p><a class="source-toggle" href="#"
|
320
|
-
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
321
|
-
<div class="method-source-code" id="M000039-source">
|
322
|
-
<pre>
|
323
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 226</span>
|
324
|
-
226: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>( <span class="ruby-identifier">request</span> )
|
325
|
-
227:
|
326
|
-
228: <span class="ruby-identifier">rx</span> = { <span class="ruby-identifier">:before</span> =<span class="ruby-operator">></span> [], <span class="ruby-identifier">:after</span> =<span class="ruby-operator">></span> [], <span class="ruby-identifier">:always</span> =<span class="ruby-operator">></span> [], <span class="ruby-identifier">:action</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:handlers</span> =<span class="ruby-operator">></span> [] }
|
327
|
-
229:
|
328
|
-
230: ( <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:before</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:wrap</span>] ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
329
|
-
231: <span class="ruby-identifier">matches</span> = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
330
|
-
232: <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:before</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">matches</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matches</span>
|
331
|
-
233: <span class="ruby-keyword kw">end</span>
|
332
|
-
234:
|
333
|
-
235: <span class="ruby-identifier">mapping</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
334
|
-
236: <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:action</span>] = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
335
|
-
237: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:action</span>]
|
336
|
-
238: <span class="ruby-keyword kw">end</span>
|
337
|
-
239:
|
338
|
-
240: ( <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:after</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:wrap</span>] ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
339
|
-
241: <span class="ruby-identifier">matches</span> = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
340
|
-
242: <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:after</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">matches</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matches</span>
|
341
|
-
243: <span class="ruby-keyword kw">end</span>
|
342
|
-
244:
|
343
|
-
245: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:always</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
344
|
-
246: <span class="ruby-identifier">matches</span> = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
345
|
-
247: <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:always</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">matches</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matches</span>
|
346
|
-
248: <span class="ruby-keyword kw">end</span>
|
347
|
-
249:
|
348
|
-
250: <span class="ruby-identifier">handlers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">exception</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
349
|
-
251: <span class="ruby-identifier">matches</span> = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
350
|
-
252: <span class="ruby-identifier">rx</span>[<span class="ruby-identifier">:handlers</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">exception</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matches</span>
|
351
|
-
253: <span class="ruby-keyword kw">end</span>
|
352
|
-
254:
|
353
|
-
255: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rx</span>
|
354
|
-
256: <span class="ruby-keyword kw">end</span>
|
355
|
-
</pre>
|
356
|
-
</div>
|
357
|
-
</div>
|
358
|
-
</div>
|
359
|
-
|
360
|
-
<div id="method-M000029" class="method-detail">
|
361
|
-
<a name="M000029"></a>
|
362
|
-
|
363
|
-
<div class="method-heading">
|
364
|
-
<a href="#M000029" class="method-signature">
|
365
|
-
<span class="method-name">after</span><span class="method-args">( path, options = {}, &block )</span>
|
366
|
-
</a>
|
367
|
-
</div>
|
368
|
-
|
369
|
-
<div class="method-description">
|
370
|
-
<p>
|
371
|
-
Similar to <a href="Mapping.html#M000028">before</a>, except it runs its
|
372
|
-
actions <a href="Mapping.html#M000029">after</a> any matching <tt><a
|
373
|
-
href="Mapping.html#M000034">url</a></tt> or <tt><a
|
374
|
-
href="Mapping.html#M000033">path</a></tt> actions. Note that <a
|
375
|
-
href="Mapping.html#M000029">after</a> methods will run even if an exception
|
376
|
-
is thrown during processing.
|
377
|
-
</p>
|
378
|
-
<p><a class="source-toggle" href="#"
|
379
|
-
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
380
|
-
<div class="method-source-code" id="M000029-source">
|
381
|
-
<pre>
|
382
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 130</span>
|
383
|
-
130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
384
|
-
131: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
385
|
-
132: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">path</span>
|
386
|
-
133: <span class="ruby-keyword kw">else</span>
|
387
|
-
134: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">path</span>
|
388
|
-
135: <span class="ruby-keyword kw">end</span>
|
389
|
-
136: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:after</span>] <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span> ]
|
390
|
-
137: <span class="ruby-keyword kw">end</span>
|
391
|
-
</pre>
|
392
|
-
</div>
|
393
|
-
</div>
|
394
|
-
</div>
|
395
|
-
|
396
|
-
<div id="method-M000031" class="method-detail">
|
397
|
-
<a name="M000031"></a>
|
398
|
-
|
399
|
-
<div class="method-heading">
|
400
|
-
<a href="#M000031" class="method-signature">
|
401
|
-
<span class="method-name">always</span><span class="method-args">( path, options = {}, &block )</span>
|
402
|
-
</a>
|
403
|
-
</div>
|
404
|
-
|
405
|
-
<div class="method-description">
|
406
|
-
<p>
|
407
|
-
Like <a href="Mapping.html#M000029">after</a>, but will run even when an
|
408
|
-
exception is thrown. Exceptions in <a
|
409
|
-
href="Mapping.html#M000031">always</a> mappings are simply logged and
|
410
|
-
ignored.
|
411
|
-
</p>
|
412
|
-
<p><a class="source-toggle" href="#"
|
413
|
-
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
414
|
-
<div class="method-source-code" id="M000031-source">
|
415
|
-
<pre>
|
416
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 152</span>
|
417
|
-
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">always</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
418
|
-
153: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
419
|
-
154: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">path</span>
|
420
|
-
155: <span class="ruby-keyword kw">else</span>
|
421
|
-
156: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">path</span>
|
422
|
-
157: <span class="ruby-keyword kw">end</span>
|
423
|
-
158: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:always</span>] <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span> ]
|
424
|
-
159: <span class="ruby-keyword kw">end</span>
|
425
|
-
</pre>
|
426
|
-
</div>
|
427
|
-
</div>
|
428
|
-
</div>
|
429
|
-
|
430
|
-
<div id="method-M000028" class="method-detail">
|
431
|
-
<a name="M000028"></a>
|
432
|
-
|
433
|
-
<div class="method-heading">
|
434
|
-
<a href="#M000028" class="method-signature">
|
435
|
-
<span class="method-name">before</span><span class="method-args">( path, options = {}, &block )</span>
|
436
|
-
</a>
|
437
|
-
</div>
|
438
|
-
|
439
|
-
<div class="method-description">
|
440
|
-
<p>
|
441
|
-
If the pattern matches and constraints given by the options hash are
|
442
|
-
satisfied, run the block <a href="Mapping.html#M000028">before</a> running
|
443
|
-
any <tt><a href="Mapping.html#M000033">path</a></tt> or <tt><a
|
444
|
-
href="Mapping.html#M000034">url</a></tt> actions. You can have as many
|
445
|
-
<tt><a href="Mapping.html#M000028">before</a></tt> matches as you want -
|
446
|
-
they will all run, unless one of them calls redirect, generates an
|
447
|
-
unhandled exception, etc.
|
448
|
-
</p>
|
449
|
-
<p><a class="source-toggle" href="#"
|
450
|
-
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
451
|
-
<div class="method-source-code" id="M000028-source">
|
452
|
-
<pre>
|
453
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 119</span>
|
454
|
-
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
455
|
-
120: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
456
|
-
121: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">path</span>
|
457
|
-
122: <span class="ruby-keyword kw">else</span>
|
458
|
-
123: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">path</span>
|
459
|
-
124: <span class="ruby-keyword kw">end</span>
|
460
|
-
125: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:before</span>] <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span> ]
|
461
|
-
126: <span class="ruby-keyword kw">end</span>
|
462
|
-
</pre>
|
463
|
-
</div>
|
464
|
-
</div>
|
465
|
-
</div>
|
466
|
-
|
467
|
-
<div id="method-M000040" class="method-detail">
|
468
|
-
<a name="M000040"></a>
|
469
|
-
|
470
|
-
<div class="method-heading">
|
471
|
-
<a href="#M000040" class="method-signature">
|
472
|
-
<span class="method-name">clear</span><span class="method-args">()</span>
|
473
|
-
</a>
|
474
|
-
</div>
|
475
|
-
|
476
|
-
<div class="method-description">
|
477
|
-
<p>
|
478
|
-
Clear all mapping rules
|
479
|
-
</p>
|
480
|
-
<p><a class="source-toggle" href="#"
|
481
|
-
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
482
|
-
<div class="method-source-code" id="M000040-source">
|
483
|
-
<pre>
|
484
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 259</span>
|
485
|
-
259: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
|
486
|
-
260: <span class="ruby-ivar">@mapping</span> = <span class="ruby-ivar">@filters</span> = <span class="ruby-ivar">@handlers</span> = <span class="ruby-keyword kw">nil</span>;
|
487
|
-
261: <span class="ruby-keyword kw">end</span>
|
488
|
-
</pre>
|
489
|
-
</div>
|
490
|
-
</div>
|
491
|
-
</div>
|
492
|
-
|
493
|
-
<div id="method-M000036" class="method-detail">
|
494
|
-
<a name="M000036"></a>
|
495
|
-
|
496
|
-
<div class="method-heading">
|
497
|
-
<a href="#M000036" class="method-signature">
|
498
|
-
<span class="method-name">handle</span><span class="method-args">(exception, options = {}, &block )</span>
|
499
|
-
</a>
|
500
|
-
</div>
|
501
|
-
|
502
|
-
<div class="method-description">
|
503
|
-
<p>
|
504
|
-
Maps an exception handler to a block.
|
505
|
-
</p>
|
506
|
-
<p><a class="source-toggle" href="#"
|
507
|
-
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
508
|
-
<div class="method-source-code" id="M000036-source">
|
509
|
-
<pre>
|
510
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 194</span>
|
511
|
-
194: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">exception</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
512
|
-
195: <span class="ruby-identifier">handlers</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">exception</span>,<span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span>]
|
513
|
-
196: <span class="ruby-keyword kw">end</span>
|
514
|
-
</pre>
|
515
|
-
</div>
|
516
|
-
</div>
|
517
|
-
</div>
|
518
|
-
|
519
|
-
<div id="method-M000032" class="method-detail">
|
520
|
-
<a name="M000032"></a>
|
521
|
-
|
522
|
-
<div class="method-heading">
|
523
|
-
<a href="#M000032" class="method-signature">
|
524
|
-
<span class="method-name">map</span><span class="method-args">( path, options = {}, params = {}, &block )</span>
|
525
|
-
</a>
|
526
|
-
</div>
|
527
|
-
|
528
|
-
<div class="method-description">
|
529
|
-
<p>
|
530
|
-
Maps a request to a block. Don‘t use this method directly unless you
|
531
|
-
know what you‘re doing. Use <tt><a
|
532
|
-
href="Mapping.html#M000033">path</a></tt> or <tt><a
|
533
|
-
href="Mapping.html#M000034">url</a></tt> instead.
|
534
|
-
</p>
|
535
|
-
<p><a class="source-toggle" href="#"
|
536
|
-
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
537
|
-
<div class="method-source-code" id="M000032-source">
|
538
|
-
<pre>
|
539
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 163</span>
|
540
|
-
163: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
541
|
-
164: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">path</span>
|
542
|
-
165: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
|
543
|
-
166: <span class="ruby-identifier">params</span> = <span class="ruby-identifier">options</span>; <span class="ruby-identifier">options</span> = <span class="ruby-identifier">path</span>
|
544
|
-
167: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
545
|
-
168: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">path</span>
|
546
|
-
169: <span class="ruby-keyword kw">end</span>
|
547
|
-
170: <span class="ruby-identifier">mapping</span> <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">block</span> ]
|
548
|
-
171: <span class="ruby-keyword kw">end</span>
|
549
|
-
</pre>
|
550
|
-
</div>
|
551
|
-
</div>
|
552
|
-
</div>
|
553
|
-
|
554
|
-
<div id="method-M000033" class="method-detail">
|
555
|
-
<a name="M000033"></a>
|
556
|
-
|
557
|
-
<div class="method-heading">
|
558
|
-
<a href="#M000033" class="method-signature">
|
559
|
-
<span class="method-name">path</span><span class="method-args">( pat, options = {}, params = {}, &block )</span>
|
560
|
-
</a>
|
561
|
-
</div>
|
562
|
-
|
563
|
-
<div class="method-description">
|
564
|
-
<p>
|
565
|
-
Match pattern against the +request.path+, along with satisfying any
|
566
|
-
constraints specified by the options hash. If the pattern matches and the
|
567
|
-
constraints are satisfied, run the block. Only one <tt><a
|
568
|
-
href="Mapping.html#M000033">path</a></tt> or <tt><a
|
569
|
-
href="Mapping.html#M000034">url</a></tt> match will be run (the first one).
|
570
|
-
</p>
|
571
|
-
<p><a class="source-toggle" href="#"
|
572
|
-
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
573
|
-
<div class="method-source-code" id="M000033-source">
|
574
|
-
<pre>
|
575
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 176</span>
|
576
|
-
176: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>( <span class="ruby-identifier">pat</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
577
|
-
177: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">pat</span>; <span class="ruby-identifier">map</span>( <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
578
|
-
178: <span class="ruby-keyword kw">end</span>
|
579
|
-
</pre>
|
580
|
-
</div>
|
581
|
-
</div>
|
582
|
-
</div>
|
583
|
-
|
584
|
-
<div id="method-M000035" class="method-detail">
|
585
|
-
<a name="M000035"></a>
|
586
|
-
|
587
|
-
<div class="method-heading">
|
588
|
-
<a href="#M000035" class="method-signature">
|
589
|
-
<span class="method-name">root</span><span class="method-args">( options = {}, params = {}, &block )</span>
|
590
|
-
</a>
|
591
|
-
</div>
|
592
|
-
|
593
|
-
<div class="method-description">
|
594
|
-
<p>
|
595
|
-
Maps the <a href="Mapping.html#M000035">root</a> of the application to a
|
596
|
-
block. If an options hash is specified it must satisfy those constraints in
|
597
|
-
order to run the block.
|
598
|
-
</p>
|
599
|
-
<p><a class="source-toggle" href="#"
|
600
|
-
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
601
|
-
<div class="method-source-code" id="M000035-source">
|
602
|
-
<pre>
|
603
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 189</span>
|
604
|
-
189: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">root</span>( <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
605
|
-
190: <span class="ruby-identifier">path</span>( <span class="ruby-regexp re">%r{^/?$}</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
606
|
-
191: <span class="ruby-keyword kw">end</span>
|
607
|
-
</pre>
|
608
|
-
</div>
|
609
|
-
</div>
|
610
|
-
</div>
|
611
|
-
|
612
|
-
<div id="method-M000037" class="method-detail">
|
613
|
-
<a name="M000037"></a>
|
614
|
-
|
615
|
-
<div class="method-heading">
|
616
|
-
<a href="#M000037" class="method-signature">
|
617
|
-
<span class="method-name">threaded</span><span class="method-args">( pat, options = {}, params = {}, &block)</span>
|
618
|
-
</a>
|
619
|
-
</div>
|
620
|
-
|
621
|
-
<div class="method-description">
|
622
|
-
<p>
|
623
|
-
Maps a request to a block that will be executed within it‘s own
|
624
|
-
thread. This is especially useful when you‘re running with an event
|
625
|
-
driven server like thin or ebb, and this block is going to take a
|
626
|
-
relatively long time.
|
627
|
-
</p>
|
628
|
-
<p><a class="source-toggle" href="#"
|
629
|
-
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
630
|
-
<div class="method-source-code" id="M000037-source">
|
631
|
-
<pre>
|
632
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 202</span>
|
633
|
-
202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">threaded</span>( <span class="ruby-identifier">pat</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
634
|
-
203: <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:threaded</span>] = <span class="ruby-keyword kw">true</span>
|
635
|
-
204: <span class="ruby-identifier">map</span>( <span class="ruby-identifier">pat</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
636
|
-
205: <span class="ruby-keyword kw">end</span>
|
637
|
-
</pre>
|
638
|
-
</div>
|
639
|
-
</div>
|
640
|
-
</div>
|
641
|
-
|
642
|
-
<div id="method-M000038" class="method-detail">
|
643
|
-
<a name="M000038"></a>
|
644
|
-
|
645
|
-
<div class="method-heading">
|
646
|
-
<a href="#M000038" class="method-signature">
|
647
|
-
<span class="method-name">threaded?</span><span class="method-args">( request )</span>
|
648
|
-
</a>
|
649
|
-
</div>
|
650
|
-
|
651
|
-
<div class="method-description">
|
652
|
-
<p>
|
653
|
-
Determines whether the request should be handled in a separate thread. This
|
654
|
-
is used by event driven servers like thin and ebb, and is most useful for
|
655
|
-
those methods that take a long time to complete, like for example upload
|
656
|
-
processes. E.g.:
|
657
|
-
</p>
|
658
|
-
<pre>
|
659
|
-
threaded("/upload", :method => :post) do
|
660
|
-
handle_upload
|
661
|
-
end
|
662
|
-
</pre>
|
663
|
-
<p>
|
664
|
-
You typically wouldn‘t use this method directly.
|
665
|
-
</p>
|
666
|
-
<p><a class="source-toggle" href="#"
|
667
|
-
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
668
|
-
<div class="method-source-code" id="M000038-source">
|
669
|
-
<pre>
|
670
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 216</span>
|
671
|
-
216: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">threaded?</span>( <span class="ruby-identifier">request</span> )
|
672
|
-
217: <span class="ruby-identifier">mapping</span>.<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">function</span> <span class="ruby-operator">|</span>
|
673
|
-
218: <span class="ruby-identifier">match</span> = <span class="ruby-identifier">match</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">function</span> )
|
674
|
-
219: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:threaded</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>
|
675
|
-
220: <span class="ruby-keyword kw">end</span>
|
676
|
-
221: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
677
|
-
222: <span class="ruby-keyword kw">end</span>
|
678
|
-
</pre>
|
679
|
-
</div>
|
680
|
-
</div>
|
681
|
-
</div>
|
682
|
-
|
683
|
-
<div id="method-M000034" class="method-detail">
|
684
|
-
<a name="M000034"></a>
|
685
|
-
|
686
|
-
<div class="method-heading">
|
687
|
-
<a href="#M000034" class="method-signature">
|
688
|
-
<span class="method-name">url</span><span class="method-args">( pat, options = {}, params = {}, &block )</span>
|
689
|
-
</a>
|
690
|
-
</div>
|
691
|
-
|
692
|
-
<div class="method-description">
|
693
|
-
<p>
|
694
|
-
Match pattern against the +request.url+, along with satisfying any
|
695
|
-
constraints specified by the options hash. If the pattern matches and the
|
696
|
-
constraints are satisfied, run the block. Only one <tt><a
|
697
|
-
href="Mapping.html#M000033">path</a></tt> or <tt><a
|
698
|
-
href="Mapping.html#M000034">url</a></tt> match will be run (the first one).
|
699
|
-
</p>
|
700
|
-
<p><a class="source-toggle" href="#"
|
701
|
-
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
702
|
-
<div class="method-source-code" id="M000034-source">
|
703
|
-
<pre>
|
704
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 183</span>
|
705
|
-
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">url</span>( <span class="ruby-identifier">pat</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
706
|
-
184: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:url</span>] = <span class="ruby-identifier">pat</span>; <span class="ruby-identifier">map</span>( <span class="ruby-identifier">options</span>, <span class="ruby-identifier">params</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
707
|
-
185: <span class="ruby-keyword kw">end</span>
|
708
|
-
</pre>
|
709
|
-
</div>
|
710
|
-
</div>
|
711
|
-
</div>
|
712
|
-
|
713
|
-
<div id="method-M000030" class="method-detail">
|
714
|
-
<a name="M000030"></a>
|
715
|
-
|
716
|
-
<div class="method-heading">
|
717
|
-
<a href="#M000030" class="method-signature">
|
718
|
-
<span class="method-name">wrap</span><span class="method-args">( path, options = {}, &block )</span>
|
719
|
-
</a>
|
720
|
-
</div>
|
721
|
-
|
722
|
-
<div class="method-description">
|
723
|
-
<p>
|
724
|
-
Run the action <a href="Mapping.html#M000028">before</a> and <a
|
725
|
-
href="Mapping.html#M000029">after</a> the matching <tt><a
|
726
|
-
href="Mapping.html#M000034">url</a></tt> or <tt><a
|
727
|
-
href="Mapping.html#M000033">path</a></tt> action.
|
728
|
-
</p>
|
729
|
-
<p><a class="source-toggle" href="#"
|
730
|
-
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
731
|
-
<div class="method-source-code" id="M000030-source">
|
732
|
-
<pre>
|
733
|
-
<span class="ruby-comment cmt"># File lib/mapping/mapping.rb, line 140</span>
|
734
|
-
140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wrap</span>( <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
735
|
-
141: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
|
736
|
-
142: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">path</span>
|
737
|
-
143: <span class="ruby-keyword kw">else</span>
|
738
|
-
144: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:path</span>] = <span class="ruby-identifier">path</span>
|
739
|
-
145: <span class="ruby-keyword kw">end</span>
|
740
|
-
146: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:before</span>] <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span> ]
|
741
|
-
147: <span class="ruby-identifier">filters</span>[<span class="ruby-identifier">:after</span>] <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">options</span>, <span class="ruby-identifier">block</span> ]
|
742
|
-
148: <span class="ruby-keyword kw">end</span>
|
743
|
-
</pre>
|
744
|
-
</div>
|
745
|
-
</div>
|
746
|
-
</div>
|
747
|
-
|
748
|
-
|
749
|
-
</div>
|
750
|
-
|
751
|
-
|
752
|
-
</div>
|
753
|
-
|
754
|
-
|
755
|
-
<div id="validator-badges">
|
756
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
757
|
-
</div>
|
758
|
-
|
759
|
-
</body>
|
760
|
-
</html>
|