Class: ActionDispatch::Routing::RoutesProxy
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::RoutesProxy
- Includes:
- UrlFor
- Defined in:
- 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, helpers, script_namer = nil) ⇒ RoutesProxy
constructor
A new instance of RoutesProxy.
- #url_options ⇒ Object
Methods included from UrlFor
#full_url_for, #route_for, #url_for
Methods included from PolymorphicRoutes
#polymorphic_path, #polymorphic_url
Constructor Details
#initialize(routes, scope, helpers, script_namer = nil) ⇒ RoutesProxy
Returns a new instance of RoutesProxy.
13 14 15 16 17 |
# File 'lib/action_dispatch/routing/routes_proxy.rb', line 13 def initialize(routes, scope, helpers, script_namer = nil) @routes, @scope = routes, scope @helpers = helpers @script_namer = script_namer end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object (private)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/action_dispatch/routing/routes_proxy.rb', line 30 def method_missing(method, *args) if @helpers.respond_to?(method) self.class.class_eval " def \#{method}(*args)\n options = args.extract_options!\n options = url_options.merge((options || {}).symbolize_keys)\n\n if @script_namer\n options[:script_name] = merge_script_names(\n options[:script_name],\n @script_namer.call(options)\n )\n end\n\n args << options\n @helpers.\#{method}(*args)\n end\n RUBY\n public_send(method, *args)\n else\n super\n end\nend\n", __FILE__, __LINE__ + 1 |
Instance Attribute Details
#routes ⇒ Object Also known as: _routes
Returns the value of attribute routes.
10 11 12 |
# File 'lib/action_dispatch/routing/routes_proxy.rb', line 10 def routes @routes end |
#scope ⇒ Object
Returns the value of attribute scope.
10 11 12 |
# File 'lib/action_dispatch/routing/routes_proxy.rb', line 10 def scope @scope end |
Instance Method Details
#url_options ⇒ Object
19 20 21 22 23 |
# File 'lib/action_dispatch/routing/routes_proxy.rb', line 19 def scope.send(:_with_routes, routes) do scope. end end |