module AbstractController::Helpers::ClassMethods

def helper_method(*methods)

to be made available on the view.
* method[, method] - A name or names of a method on the controller
==== Parameters

<% if logged_in? -%>Welcome, <%= current_user.name %><% end -%>
In a view:

end
end
current_user != nil
def logged_in?

end
@current_user ||= User.find_by(id: session[:user])
def current_user
private

helper_method :current_user, :logged_in?
class ApplicationController < ActionController::Base
to the view:
makes the +current_user+ and +logged_in?+ controller methods available
Declare a controller method as a helper. For example, the following
def helper_method(*methods)
  methods.flatten!
  self._helper_methods += methods
  location = caller_locations(1, 1).first
  file, line = location.path, location.lineno
  methods.each do |method|
    # def current_user(*args, &block)
    #   controller.send(:'current_user', *args, &block)
    # end
    _helpers_for_modification.class_eval <<~ruby_eval.lines.map(&:strip).join(";"), file, line
      def #{method}(*args, &block)
        controller.send(:'#{method}', *args, &block)
      end
      ruby2_keywords(:'#{method}')
    ruby_eval
  end
end