class ModuleFinder

Object in charge of finding a prefix

Public Class Methods

dig(routes) click to toggle source
# File lib/module_finder.rb, line 6
def dig(routes)
  find_scope_of_route(routes.instance_variable_get('@scope'))
end
find_scope_of_route(route) click to toggle source
# File lib/module_finder.rb, line 10
def find_scope_of_route(route)
  found = route&.instance_variable_get('@hash')&.try(:[], :module)
  return found if found

  route = route.instance_variable_get('@parent')
  if route
    find_scope_of_route(route)
  else
    ''
  end
end