Class: Pageflow::Admin::ExtensibleAttributesTable::RowDelegator
- Inherits:
-
Object
- Object
- Pageflow::Admin::ExtensibleAttributesTable::RowDelegator
- Defined in:
- app/views/components/pageflow/admin/extensible_attributes_table.rb
Overview
Instance Method Summary collapse
-
#initialize(context, row_handler) ⇒ RowDelegator
constructor
A new instance of RowDelegator.
- #row(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize(context, row_handler) ⇒ RowDelegator
Returns a new instance of RowDelegator.
59 60 61 62 |
# File 'app/views/components/pageflow/admin/extensible_attributes_table.rb', line 59 def initialize(context, row_handler) @context = context @row_handler = row_handler end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **kwargs, &block) ⇒ Object (private)
rubocop:disable Style/MethodMissing Normally we would delegate to super if context does not respond_to? method. But Arbre appears to report not to repond to helpers like authorized? even if it does.
This is also the reason we can not use SimpleDelegator here and also delegate_missing in Rails 5 would not work.
81 82 83 |
# File 'app/views/components/pageflow/admin/extensible_attributes_table.rb', line 81 def method_missing(method, *args, **kwargs, &block) @context.public_send(method, *args, **kwargs, &block) end |
Instance Method Details
#row(name, options = {}, &block) ⇒ Object
64 65 66 |
# File 'app/views/components/pageflow/admin/extensible_attributes_table.rb', line 64 def row(name, = {}, &block) @row_handler.row(name, , &block) end |