Class: Pageflow::Admin::ExtensibleAttributesTable::RowDelegator

Inherits:
Object
  • Object
show all
Defined in:
app/views/components/pageflow/admin/extensible_attributes_table.rb

Overview

Since:

  • 12.2

Instance Method Summary collapse

Constructor Details

#initialize(context, row_handler) ⇒ RowDelegator

Returns a new instance of RowDelegator.

Since:

  • 12.2



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.

Since:

  • 12.2



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

Since:

  • 12.2



64
65
66
# File 'app/views/components/pageflow/admin/extensible_attributes_table.rb', line 64

def row(name, options = {}, &block)
  @row_handler.row(name, options, &block)
end