Class: Jets::Router::RouteSet::NamedRouteCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/router/route_set.rb

Overview

With Jets, this class is not a really a Collection. It’s a wrapper around Helpers::NamedRoutes::Generated which does the real work. Naming it NamedRouteCollection to be consistent with Rails and possibly in the future to make them more similar.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route_set) ⇒ NamedRouteCollection

Returns a new instance of NamedRouteCollection.



36
37
38
# File 'lib/jets/router/route_set.rb', line 36

def initialize(route_set)
  @url_helpers_module = Helpers::NamedRoutes::Generated.create_helper_module(route_set)
end

Instance Attribute Details

#url_helpers_moduleObject (readonly)

Returns the value of attribute url_helpers_module.



35
36
37
# File 'lib/jets/router/route_set.rb', line 35

def url_helpers_module
  @url_helpers_module
end

Instance Method Details

#helper_namesObject

interface method Rails AbstractController::UrlFor calls this method Reason why this wrapper is needed.



43
44
45
46
# File 'lib/jets/router/route_set.rb', line 43

def helper_names
  url_helpers_module.path_helpers.map(&:to_s) +
  url_helpers_module.url_helpers.map(&:to_s)
end