Class: RailsBestPractices::Prepares::RoutePrepare

Inherits:
Core::Check
  • Object
show all
Defined in:
lib/rails_best_practices/prepares/route_prepare.rb

Overview

Remembber routes.

Constant Summary collapse

RESOURCES_ACTIONS =
%w[index show new create edit update destroy].freeze
RESOURCE_ACTIONS =
%w[show new create edit update destroy].freeze

Constants inherited from Core::Check

Core::Check::ALL_FILES, Core::Check::CAPFILE, Core::Check::CONFIG_FILES, Core::Check::CONTROLLER_FILES, Core::Check::DEPLOY_FILES, Core::Check::GEMFILE_LOCK, Core::Check::HELPER_FILES, Core::Check::INITIALIZER_FILES, Core::Check::MAILER_FILES, Core::Check::MIGRATION_FILES, Core::Check::MODEL_FILES, Core::Check::PARTIAL_VIEW_FILES, Core::Check::ROUTE_FILES, Core::Check::SCHEMA_FILE, Core::Check::SKIP_FILES, Core::Check::VIEW_FILES

Instance Method Summary collapse

Methods inherited from Core::Check

#add_error, debug, debug?, #errors, #is_ignored?, #is_interesting_file?, #method_missing, #parse_file?, #regex_ignored_files, #url, url

Constructor Details

#initializeRoutePrepare

Returns a new instance of RoutePrepare.



13
14
15
16
17
# File 'lib/rails_best_practices/prepares/route_prepare.rb', line 13

def initialize
  @routes = Prepares.routes
  @namespaces = []
  @controller_names = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RailsBestPractices::Core::Check

Instance Method Details

#current_controller_nameObject



258
259
260
# File 'lib/rails_best_practices/prepares/route_prepare.rb', line 258

def current_controller_name
  @controller_names.last || @controller_name.try(:last)
end

#current_namespacesObject



254
255
256
# File 'lib/rails_best_practices/prepares/route_prepare.rb', line 254

def current_namespaces
  @namespaces.dup
end