| Class | ActionController::Routing::RouteSet::NamedRouteCollection |
| In: |
vendor/rails/actionpack/lib/action_controller/routing.rb
|
| Parent: | Object |
A NamedRouteCollection instance is a collection of named routes, and also maintains an anonymous module that can be used to install helpers for the named routes.
| helpers | [R] | |
| routes | [R] |
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 972
972: def initialize
973: clear!
974: end
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 982
982: def add(name, route)
983: routes[name.to_sym] = route
984: define_named_route_methods(name, route)
985: end
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 976
976: def clear!
977: @routes = {}
978: @helpers = []
979: @module = Module.new
980: end
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 995
995: def each
996: routes.each { |name, route| yield name, route }
997: self
998: end
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 987
987: def get(name)
988: routes[name.to_sym]
989: end
# File vendor/rails/actionpack/lib/action_controller/routing.rb, line 1008
1008: def install(dest = ActionController::Base)
1009: dest.send :include, @module
1010: if dest.respond_to? :helper_method
1011: helpers.each { |name| dest.send :helper_method, name }
1012: end
1013: end