Class: RuboCop::Cop::Rails::RouteCollector
- Inherits:
-
Object
- Object
- RuboCop::Cop::Rails::RouteCollector
- Defined in:
- lib/rubocop/cop/shared/route_collector.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #add_route(route_info) ⇒ Object
- #collect(node, namespace_level = 0, namespace_path = []) ⇒ Object
-
#initialize ⇒ RouteCollector
constructor
A new instance of RouteCollector.
Constructor Details
#initialize ⇒ RouteCollector
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
#routes ⇒ Object (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 |