module Roda::RodaPlugins::Base::ClassMethods
def freeze
Note that freezing the class prevents you from subclassing it, mostly because
be raised if you try to modify the internal state after calling this.
internal state at runtime anyway, but this makes sure an exception will
It's optional to call this method, as nothing should be modifying the
Freeze the internal state of the class, to avoid thread safety issues at runtime.
def freeze return self if frozen? unless opts[:subclassed] # If the _roda_run_main_route instance method has not been overridden, # make it an alias to _roda_main_route for performance if instance_method(:_roda_run_main_route).owner == InstanceMethods class_eval("alias _roda_run_main_route _roda_main_route") end self::RodaResponse.class_eval do if instance_method(:set_default_headers).owner == ResponseMethods && instance_method(:default_headers).owner == ResponseMethods private alias set_default_headers set_default_headers def set_default_headers @headers['Content-Type'] ||= 'text/html' end end end if @middleware.empty? && use_new_dispatch_api? plugin :direct_call end end build_rack_app @opts.freeze @middleware.freeze super end