module Roda::RodaPlugins::MultiRun::ClassMethods

def freeze

Freeze the multi_run apps so that there can be no thread safety issues at runtime.
and to speed up subsequent calls.
Convert app blocks into apps by calling them, in order to force autoloads
def freeze
  app_blocks = opts[:multi_run_app_blocks]
  apps = opts[:multi_run_apps]
  app_blocks.each do |prefix, block|
    apps[prefix] = block.call
  end
  app_blocks.clear.freeze
  apps.freeze
  self::RodaRequest.refresh_multi_run_regexp!
  super
end

def multi_run_apps

for the application.
Hash storing rack applications to dispatch to, keyed by the prefix
def multi_run_apps
  opts[:multi_run_apps]
end

def run(prefix, app=nil, &block)

removed. It is an error to provide both an app and block in the same call.
a block or an app is provided, any stored route for the prefix is
there is a request for the route to get the app to call. If neither
r.multi_run is called. If a block is given, it is called every time
Add a rack application to dispatch to for the given prefix when
def run(prefix, app=nil, &block)
  prefix = prefix.to_s
  if app 
    raise Roda::RodaError, "cannot provide both app and block to Roda.run" if block
    opts[:multi_run_apps][prefix] = app
    opts[:multi_run_app_blocks].delete(prefix)
  elsif block
    opts[:multi_run_apps].delete(prefix)
    opts[:multi_run_app_blocks][prefix] = block
  else
    opts[:multi_run_apps].delete(prefix)
    opts[:multi_run_app_blocks].delete(prefix)
  end
  self::RodaRequest.refresh_multi_run_regexp!
end