Class: AdminWidgets::ViewProxy
- Inherits:
- ActiveSupport::BasicObject
- Defined in:
- lib/admin_widgets/view_proxy.rb
Instance Attribute Summary collapse
-
#widget ⇒ Object
Returns the value of attribute widget.
Instance Method Summary collapse
-
#initialize(view, widget) ⇒ ViewProxy
constructor
A new instance of ViewProxy.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(view, widget) ⇒ ViewProxy
Returns a new instance of ViewProxy.
6 7 8 9 |
# File 'lib/admin_widgets/view_proxy.rb', line 6 def initialize(view, ) @widget = @view = buffered_view(view) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/admin_widgets/view_proxy.rb', line 11 def method_missing(method_name, *args, &block) target = case when .dsl_methods.include?(method_name.to_sym) then @widget else @view end target.send(method_name, *args, &block) end |
Instance Attribute Details
#widget ⇒ Object
Returns the value of attribute widget.
4 5 6 |
# File 'lib/admin_widgets/view_proxy.rb', line 4 def @widget end |