Module: Roda::RodaPlugins::MultiRun::ClassMethods

Defined in:
lib/roda/plugins/multi_run.rb

Instance Method Summary collapse

Instance Method Details

#freezeObject

Freeze the multi_run apps so that there can be no thread safety issues at runtime.



59
60
61
62
63
# File 'lib/roda/plugins/multi_run.rb', line 59

def freeze
  opts[:multi_run_apps].freeze
  self::RodaRequest.refresh_multi_run_regexp!
  super
end

#multi_run_appsObject

Hash storing rack applications to dispatch to, keyed by the prefix for the application.



67
68
69
# File 'lib/roda/plugins/multi_run.rb', line 67

def multi_run_apps
  opts[:multi_run_apps]
end

#run(prefix, app = nil) ⇒ Object

Add a rack application to dispatch to for the given prefix when r.multi_run is called.



73
74
75
76
77
78
79
80
# File 'lib/roda/plugins/multi_run.rb', line 73

def run(prefix, app=nil)
  if app
    multi_run_apps[prefix.to_s] = app
  else
    multi_run_apps.delete(prefix.to_s)
  end
  self::RodaRequest.refresh_multi_run_regexp!
end