Public Instance methods
request_module(mod = nil, &block)
Include the given module in the request class. If a block is provided instead of a module, create a module using the the block. Example:
Roda.request_module SomeModule Roda.request_module do def description "#{request_method} #{path_info}" end end Roda.route do |r| r.description end
[show source]
# File lib/roda/plugins/module_include.rb 39 def request_module(mod = nil, &block) 40 module_include(:request, mod, &block) 41 end
response_module(mod = nil, &block)
Include the given module in the response class. If a block is provided instead of a module, create a module using the the block. Example:
Roda.response_module SomeModule Roda.response_module do def error! self.status = 500 end end Roda.route do |r| response.error! end
[show source]
# File lib/roda/plugins/module_include.rb 58 def response_module(mod = nil, &block) 59 module_include(:response, mod, &block) 60 end