Class: RuboCop::Cop::Rails::RouteCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/shared/route_collector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouteCollector

Returns a new instance of RouteCollector.



11
12
13
# File 'lib/rubocop/cop/shared/route_collector.rb', line 11

def initialize
  @routes = []
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



9
10
11
# File 'lib/rubocop/cop/shared/route_collector.rb', line 9

def routes
  @routes
end

Instance Method Details

#add_route(route_info) ⇒ Object



20
21
22
# File 'lib/rubocop/cop/shared/route_collector.rb', line 20

def add_route(route_info)
  @routes << route_info
end

#collect(node, namespace_level = 0, namespace_path = []) ⇒ Object



15
16
17
18
# File 'lib/rubocop/cop/shared/route_collector.rb', line 15

def collect(node, namespace_level = 0, namespace_path = [])
  context = CollectionContext.new(self, namespace_level, namespace_path)
  context.process_node(node)
end