From 750f6c8fb0b3bd10229adcca7963937c05ac122b Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 7 Sep 2026 23:33:52 +0200 Subject: [PATCH] Silence the MultiJson deprecation warning in every test run sinatra/json defaults its :json_encoder to MultiJson and calls .encode on it, which newer multi_json versions deprecate in favor of a constant this app has no other use for (sinatra-contrib 4.2.1, the current release, still calls the old one -- not something fixable by bumping a version). Every use of the json helper here is a plain hash/array, so pointing :json_encoder at stdlib JSON instead sidesteps multi_json entirely. --- app.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.rb b/app.rb index b7d14b7..7bd129b 100644 --- a/app.rb +++ b/app.rb @@ -16,6 +16,13 @@ module Maptool set :public_folder, File.join(__dir__, "public") set :views, File.join(__dir__, "views") + # sinatra/json defaults to MultiJson, whose `encode` (what + # sinatra-contrib 4.2.1 actually calls) is deprecated in newer + # multi_json versions in favor of a constant this app has no other use + # for — stdlib JSON already does the same job and every use of the + # `json` helper below is a plain hash/array, nothing MultiJson-specific. + set :json_encoder, JSON + # A persistent secret across restarts/redeploys — otherwise every deploy # would invalidate every logged-in session's cookie (see # docs/deployment.adoc). Falls back to a random one so the app still