module Roda::RodaPlugins::ModuleInclude::ClassMethods

def module_include(type, mod)

Backbone of the request_module and response_module methods.
def module_include(type, mod)
  if type == :response
    klass = self::RodaResponse
    iv = :@response_module
  else
    klass = self::RodaRequest
    iv = :@request_module
  end
  if mod
    raise RodaError, "can't provide both argument and block to response_module" if block_given?
    klass.send(:include, mod)
  else
    if instance_variable_defined?(iv)
      mod = instance_variable_get(iv)
    else
      mod = instance_variable_set(iv, Module.new)
      klass.send(:include, mod)
    end
    mod.module_eval(&Proc.new) if block_given?
  end
  mod
end