module Roda::RodaPlugins::MultiRoute::ClassMethods

  1. lib/roda/plugins/multi_route.rb

Methods

Public Instance

  1. freeze
  2. inherited
  3. route

Public Instance methods

freeze()

Freeze the multi_route regexp matchers so that there can be no thread safety issues at runtime.

[show source]
    # File lib/roda/plugins/multi_route.rb
 95 def freeze
 96   super
 97   opts[:namespaced_routes].each_key do |k|
 98     self::RodaRequest.named_route_regexp(k)
 99   end
100   self::RodaRequest.instance_variable_get(:@namespaced_route_regexps).freeze
101   self
102 end
inherited(subclass)

Copy the named routes into the subclass when inheriting.

[show source]
    # File lib/roda/plugins/multi_route.rb
105 def inherited(subclass)
106   super
107   subclass::RodaRequest.instance_variable_set(:@namespaced_route_regexps, {})
108 end
route(name=nil, namespace=nil, &block)

Clear the multi_route regexp matcher for the namespace.

[show source]
    # File lib/roda/plugins/multi_route.rb
111 def route(name=nil, namespace=nil, &block)
112   super
113   if name
114     self::RodaRequest.clear_named_route_regexp!(namespace)
115   end
116 end