def _add_element_method(name, opts, &block)
      how = opts.delete(:how)
      hooks = opts.delete(:hooks)
      wrapper_fn = opts.delete(:wrapper_fn) || ->(e, _p) { return e }

      ele_meth = "#{name}_element"
      define_method(ele_meth) do
        ele = yield self if block_given?
        ele ||= how.call(name, self, opts) if how.is_a?(Proc)
        ele ||= send(how, opts)
        ele = wrapper_fn.call(ele, self)
        hooks.nil? ? ele : send(:apply_hooks, hooks, ele)
      end
      ele_meth
    end
def _add_element_method(name, opts, &block)
      how = opts.delete(:how)
      hooks = opts.delete(:hooks)
      wrapper_fn = opts.delete(:wrapper_fn) || ->(e, _p) { return e }

      ele_meth = "#{name}_element"
      define_method(ele_meth) do
        ele = yield self if block_given?
        ele ||= how.call(name, self, opts) if how.is_a?(Proc)
        ele ||= send(how, opts)
        ele = wrapper_fn.call(ele, self)
        hooks.nil? ? ele : send(:apply_hooks, hooks, ele)
      end
      ele_meth
    end
rubocop:disable Metrics/AbcSize
 Helper function to reduce perceived complexity of element