class Js::Routes::Rails::RouteFinder
Attributes
routes[R]
Public Class Methods
new(application_routes = nil)
click to toggle source
# File lib/js-routes/rails/route_finder.rb, line 7 def initialize(application_routes = nil) @routes = {} @application_routes = application_routes find_routes end
Public Instance Methods
find_routes()
click to toggle source
# File lib/js-routes/rails/route_finder.rb, line 13 def find_routes @application_routes.to_a.each do |route| if route.defaults.key?(:export) && route.name.present? @routes[path_helper(route)] = path(route) end end end
path(route)
click to toggle source
# File lib/js-routes/rails/route_finder.rb, line 25 def path(route) route.path.spec.to_s.chomp("(.:format)") end
path_helper(route)
click to toggle source
# File lib/js-routes/rails/route_finder.rb, line 21 def path_helper(route) "#{route.name}_path" end