Module: MethodMissingRouter::RoutedMethodMissing
- Defined in:
- lib/method_missing_router.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/method_missing_router.rb', line 19
def method_missing(method_name, *args, &block)
if route = method_missing_routes.route_for(method_name)
call_info = CallInfo.new(self, route.target, *args, &block)
call_info.prepend_argument(route.message_for(method_name))
return call_info.call
else
super(method_name, *args, &block)
end
end
|
Instance Method Details
#respond_to_missing?(method_name) ⇒ Boolean
13
14
15
|
# File 'lib/method_missing_router.rb', line 13
def respond_to_missing?(method_name, *)
method_missing_routes.route_for(method_name) || super
end
|