Class: Rails::Engine::LazyRouteSet

Inherits:
ActionDispatch::Routing::RouteSet
  • Object
show all
Defined in:
lib/rails/engine/lazy_route_set.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ProxyUrlHelpers Classes: NamedRouteCollection

Instance Method Summary collapse

Constructor Details

#initialize(config = DEFAULT_CONFIG) ⇒ LazyRouteSet

Returns a new instance of LazyRouteSet.



49
50
51
52
53
54
# File 'lib/rails/engine/lazy_route_set.rb', line 49

def initialize(config = DEFAULT_CONFIG)
  super
  self.named_routes = NamedRouteCollection.new
  named_routes.url_helpers_module.prepend(method_missing_module)
  named_routes.path_helpers_module.prepend(method_missing_module)
end

Instance Method Details

#call(req) ⇒ Object



66
67
68
69
# File 'lib/rails/engine/lazy_route_set.rb', line 66

def call(req)
  Rails.application&.reload_routes_unless_loaded
  super
end

#draw(&block) ⇒ Object



71
72
73
74
# File 'lib/rails/engine/lazy_route_set.rb', line 71

def draw(&block)
  Rails.application&.reload_routes_unless_loaded
  super
end

#generate_extras(options, recall = {}) ⇒ Object



56
57
58
59
60
# File 'lib/rails/engine/lazy_route_set.rb', line 56

def generate_extras(options, recall = {})
  Rails.application&.reload_routes_unless_loaded

  super(options, recall)
end

#generate_url_helpers(supports_path) ⇒ Object



62
63
64
# File 'lib/rails/engine/lazy_route_set.rb', line 62

def generate_url_helpers(supports_path)
  super.tap { |mod| mod.singleton_class.prepend(ProxyUrlHelpers) }
end

#recognize_path(path, environment = {}) ⇒ Object



76
77
78
79
# File 'lib/rails/engine/lazy_route_set.rb', line 76

def recognize_path(path, environment = {})
  Rails.application&.reload_routes_unless_loaded
  super
end

#recognize_path_with_requestObject



81
82
83
84
# File 'lib/rails/engine/lazy_route_set.rb', line 81

def recognize_path_with_request(...)
  Rails.application&.reload_routes_unless_loaded
  super
end

#routesObject



86
87
88
89
# File 'lib/rails/engine/lazy_route_set.rb', line 86

def routes
  Rails.application&.reload_routes_unless_loaded
  super
end