class Rodauth::Feature
def route(name=feature_name, default=name.to_s.tr('_', '-'), &block)
def route(name=feature_name, default=name.to_s.tr('_', '-'), &block) route_meth = :"#{name}_route" auth_value_method route_meth, default define_method(:"#{name}_path"){|opts={}| route_path(send(route_meth), opts) if send(route_meth)} define_method(:"#{name}_url"){|opts={}| route_url(send(route_meth), opts) if send(route_meth)} handle_meth = :"handle_#{name}" internal_handle_meth = :"_#{handle_meth}" before route_meth define_method(internal_handle_meth, &block) define_method(handle_meth) do request.is send(route_meth) do @current_route = name check_csrf if check_csrf? _around_rodauth do before_rodauth send(internal_handle_meth, request) end end end routes << handle_meth end