Parent

Files

RailsBestPractices::Checks::OveruseRouteCustomizationsCheck

Check config/routes.rb to make sure there are no much route customizations.

Implementation: check member and collection route count, if more than customize_count, then it is overuse route customizations.

Public Class Methods

new(options = {}) click to toggle source
# File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 18
def initialize(options = {})
  super()
  @customize_count = options['customize_count'] || 3
end

Public Instance Methods

evaluate_start(node) click to toggle source
# File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 23
def evaluate_start(node)
  if :resources == node.message
    add_error "overuse route customizations (customize_count > #{@customize_count})" if member_and_collection_count(node) > @customize_count
  end
end
interesting_files() click to toggle source
# File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 14
def interesting_files
  /config\/routes.rb/
end
interesting_nodes() click to toggle source
# File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 10
def interesting_nodes
  [:call]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.