Sha256: d5e1f403dd3fad1ade6c2d7c707231c00130ccc74d27bb5152a0bd045d339d54
Contents?: true
Size: 965 Bytes
Versions: 1
Compression:
Stored size: 965 Bytes
Contents
# encoding: utf-8 module PagesCore module ProcessTitler extend ActiveSupport::Concern included do before_action :set_process_title after_action :unset_process_title end class << self attr_accessor :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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.5.1 | app/controllers/concerns/pages_core/process_titler.rb |