module Roda::RodaPlugins::ModuleInclude::ClassMethods

def module_include(type, mod, &block)

Backbone of the request_module and response_module methods.
def module_include(type, mod, &block)
  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 defined?(yield)
    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(&block) if block
  end
  mod
end