module Roda::RodaPlugins::RequestAref

  1. lib/roda/plugins/request_aref.rb

The request_aref plugin allows for custom handling of the r[] and r[]= methods (where r is the Request instance). In the current version of rack, these methods are deprecated, but the deprecation message is only printed in verbose mode. This plugin can allow for handling calls to these methods in one of three ways:


Allow the method calls without a deprecation, which is the historical behavior


Always issue a deprecation message by calling warn, not just in verbose mode.


Raise an error if either method is called


Public Class

  1. configure

Public Class methods

configure (app, setting)

Make [] and []= methods work as configured by aliasing the appropriate request_a(ref|set)_* methods to them.

[show source]
# File lib/roda/plugins/request_aref.rb, line 19
def self.configure(app, setting)
  case setting
  when :allow, :raise, :warn
    app::RodaRequest.class_eval do
      alias_method(:[],  :"request_aref_#{setting}")
      alias_method(:[]=, :"request_aset_#{setting}")
      public :[], :[]=
    raise RodaError, "Unsupport request_aref plugin setting: #{setting.inspect}"