Sha256: 88f0bdc0f15d9ea75f346d33d2d937332582158b94e33064e4c947991f8ade92
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
# frozen_string_literal: true module CookieDebugger # Main Debug class class Debug class << self def call(request) cookie_data = map_size(request.cookies) session_data = map_size(request.session) "CookieDebugger (total size: #{request.headers['Cookie']&.bytesize || 0} bytes) from url: #{request.url}" \ " | Cookie: #{cookie_data}" \ " | Session: #{session_data}" end private def map_size(source) mapped_sizes = {} source.each do |key, val| size = val.to_s.bytesize.to_i mapped_sizes[size] = [mapped_sizes[size], "[#{key}=#{size}]"].compact.join(', ') end mapped_sizes.sort.reverse.map(&:last).join(' ') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cookie_debugger-1.0.0 | lib/cookie_debugger.rb |