Class: RailsRouteChecker::AppInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-route-checker/app_interface.rb

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ AppInterface

Returns a new instance of AppInterface.



5
6
7
# File 'lib/rails-route-checker/app_interface.rb', line 5

def initialize(**opts)
  @options = { ignored_controllers: [], ignored_paths: [], ignored_path_whitelist: {} }.merge(opts)
end

Instance Method Details

#routes_without_actionsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rails-route-checker/app_interface.rb', line 9

def routes_without_actions
  loaded_app.routes.map do |r|
    controller = r.requirements[:controller]
    action = r.requirements[:action]

    next if options[:ignored_controllers].include?(controller)
    next if controller_has_action?(controller, action)

    {
      controller: controller,
      action: action
    }
  end.compact
end

#undefined_path_method_callsObject



24
25
26
# File 'lib/rails-route-checker/app_interface.rb', line 24

def undefined_path_method_calls
  generate_undef_view_path_calls + generate_undef_controller_path_calls
end