Class: ActionDispatch::Routing::RoutesProxy
- Includes:
- UrlFor
- Defined in:
- actionpack/lib/action_dispatch/routing/routes_proxy.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#routes ⇒ Object
(also: #_routes)
Returns the value of attribute routes.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(routes, scope) ⇒ RoutesProxy
constructor
A new instance of RoutesProxy.
- #method_missing(method, *args) ⇒ Object
- #url_options ⇒ Object
Methods included from UrlFor
Methods included from ActiveSupport::Concern
#append_features, extended, #included
Methods included from PolymorphicRoutes
#polymorphic_path, #polymorphic_url
Constructor Details
#initialize(routes, scope) ⇒ RoutesProxy
Returns a new instance of RoutesProxy.
9 10 11 |
# File 'actionpack/lib/action_dispatch/routing/routes_proxy.rb', line 9 def initialize(routes, scope) @routes, @scope = routes, scope end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'actionpack/lib/action_dispatch/routing/routes_proxy.rb', line 19 def method_missing(method, *args) if routes.url_helpers.respond_to?(method) self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{method}(*args) options = args.extract_options! args << url_options.merge((options || {}).symbolize_keys) routes.url_helpers.#{method}(*args) end RUBY send(method, *args) else super end end |
Instance Attribute Details
#routes ⇒ Object Also known as: _routes
Returns the value of attribute routes
6 7 8 |
# File 'actionpack/lib/action_dispatch/routing/routes_proxy.rb', line 6 def routes @routes end |
#scope ⇒ Object
Returns the value of attribute scope
6 7 8 |
# File 'actionpack/lib/action_dispatch/routing/routes_proxy.rb', line 6 def scope @scope end |
Instance Method Details
#url_options ⇒ Object
13 14 15 16 17 |
# File 'actionpack/lib/action_dispatch/routing/routes_proxy.rb', line 13 def scope.send(:_with_routes, routes) do scope. end end |