Sha256: 2b696d2264cfb2a11fab225f394475780534a5f3764808683a6ae91e5fa34725
Contents?: true
Size: 975 Bytes
Versions: 29
Compression:
Stored size: 975 Bytes
Contents
# frozen_string_literal: true module PagesCore module ProcessTitler extend ActiveSupport::Concern included do before_action :set_process_title after_action :unset_process_title end class << self attr_writer :number_of_requests def original_title @original_title ||= $PROGRAM_NAME end def inc_number_of_requests @number_of_requests ||= 0 @number_of_requests += 1 yield @number_of_requests end def number_of_requests @number_of_requests ||= 0 end end protected def set_process_title PagesCore::ProcessTitler.inc_number_of_requests do |i| $0 = PagesCore::ProcessTitler.original_title + ": Handling #{request.path} (#{i} reqs)" end end def unset_process_title $0 = PagesCore::ProcessTitler.original_title + ": Idle (#{PagesCore::ProcessTitler.number_of_requests} reqs)" end end end
Version data entries
29 entries across 29 versions & 1 rubygems