From 3b39411152736ad14752fbc06d7e592d779216ea Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:30:47 +0200 Subject: [PATCH] Drop `base64` dependency On Ruby 3.4 this isn't a default gem anymore --- lib/memory_profiler/autorun.rb | 3 +-- lib/memory_profiler/cli.rb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/memory_profiler/autorun.rb b/lib/memory_profiler/autorun.rb index 745dfd3..8f600eb 100644 --- a/lib/memory_profiler/autorun.rb +++ b/lib/memory_profiler/autorun.rb @@ -1,10 +1,9 @@ # frozen_string_literal: true require "memory_profiler" -require "base64" def deserialize_hash(data) - Marshal.load(Base64.urlsafe_decode64(data)) if data + Marshal.load(data.unpack1("m0")) if data end options = deserialize_hash(ENV["MEMORY_PROFILER_OPTIONS"]) || {} diff --git a/lib/memory_profiler/cli.rb b/lib/memory_profiler/cli.rb index ee8a613..e55bd9c 100644 --- a/lib/memory_profiler/cli.rb +++ b/lib/memory_profiler/cli.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "optparse" -require "base64" module MemoryProfiler class CLI @@ -141,7 +140,7 @@ def profile_command(options, argv) end def serialize_hash(hash) - Base64.urlsafe_encode64(Marshal.dump(hash)) + [Marshal.dump(hash)].pack("m0") end end end