module Roda::RodaPlugins::Base::ClassMethods

def inherited(subclass)

and setup the request and response subclasses.
When inheriting Roda, copy the shared data into the subclass,
def inherited(subclass)
  raise RodaError, "Cannot subclass a frozen Roda class" if frozen?
  # Mark current class as having been subclassed, as some optimizations
  # depend on the class not being subclassed
  opts[:subclassed] = true
  super
  subclass.instance_variable_set(:@inherit_middleware, @inherit_middleware)
  subclass.instance_variable_set(:@middleware, @inherit_middleware ? @middleware.dup : [])
  subclass.instance_variable_set(:@opts, opts.dup)
  subclass.opts.delete(:subclassed)
  subclass.opts.to_a.each do |k,v|
    if (v.is_a?(Array) || v.is_a?(Hash)) && !v.frozen?
      subclass.opts[k] = v.dup
    end
  end
  if block = @raw_route_block
    subclass.route(&block)
  end
  
  request_class = Class.new(self::RodaRequest)
  request_class.roda_class = subclass
  request_class.match_pattern_cache = RodaCache.new
  subclass.const_set(:RodaRequest, request_class)
  response_class = Class.new(self::RodaResponse)
  response_class.roda_class = subclass
  subclass.const_set(:RodaResponse, response_class)
end