Class: Oprah::ControllerHelpers::ViewContextProxy
- Inherits:
-
ActiveSupport::ProxyObject
- Object
- ActiveSupport::ProxyObject
- Oprah::ControllerHelpers::ViewContextProxy
- Defined in:
- lib/oprah/controller_helpers.rb
Overview
A proxy class to delegate method calls to view contexts in presenters to the most recently created view context by #view_context.
‘ViewContextProxy` objects are automatically created in #present and #present_many and shouldn’t have to be created manually.
Instance Method Summary collapse
-
#initialize(controller) ⇒ ViewContextProxy
constructor
A new instance of ViewContextProxy.
-
#method_missing(meth, *args, &block) ⇒ Object
Delegates all method calls to the ‘ActionView::Base` returned from #oprah_view_context.
Constructor Details
#initialize(controller) ⇒ ViewContextProxy
Returns a new instance of ViewContextProxy.
17 18 19 |
# File 'lib/oprah/controller_helpers.rb', line 17 def initialize(controller) @controller = controller end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
Delegates all method calls to the ‘ActionView::Base` returned from Oprah::ControllerHelpers#oprah_view_context.
23 24 25 |
# File 'lib/oprah/controller_helpers.rb', line 23 def method_missing(meth, *args, &block) @controller.oprah_view_context.__send__(meth, *args, &block) end |