From c6bb4b08fce91ff954feedab0f6fc0c8f5158d53 Mon Sep 17 00:00:00 2001 From: Daniel Vu Date: Thu, 25 Jun 2026 04:23:42 -0400 Subject: [PATCH] Ruby 3.3 compat: drop json/fastercsv gemspec pins; Fixnum -> Integer in enum Drop fastercsv (~> 1.5) and json (~> 1.6) runtime deps (both unmaintained and broken on Ruby 3.x). The runtime uses multi_json + stdlib csv; these pins only cause bundle conflicts. Also replace ::Fixnum with ::Integer in enum.rb: Fixnum was unified into Integer in Ruby 2.4 and the constant was removed in Ruby 3.2. --- dm-types.gemspec | 10 ++++++++-- lib/dm-types/enum.rb | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dm-types.gemspec b/dm-types.gemspec index 52e296f..9fe8c6a 100644 --- a/dm-types.gemspec +++ b/dm-types.gemspec @@ -15,10 +15,16 @@ Gem::Specification.new do |gem| gem.require_paths = [ "lib" ] gem.version = '1.2.2' + # Ruby 3.3 compatibility: the original 1.2.2 gemspec pinned json (~> 1.6) and + # fastercsv (~> 1.5), both unmaintained and incompatible with Ruby 3.x: + # * json 1.8.x fails to resolve cleanly against the modern default json gem + # and forces json_pure 1.8.6 into the bundle (broken on Ruby 3.2+). + # * fastercsv targets Ruby 1.8 only; Ruby 1.9+ ships csv in the stdlib. + # The runtime never uses these directly: json.rb uses multi_json, and csv.rb + # `require 'csv'` (stdlib) first, only falling back to fastercsv on Ruby < 1.9. + # Drop both pins so the bundle can use multi_json + the modern default json gem. gem.add_runtime_dependency('bcrypt-ruby', '~> 3.0') - gem.add_runtime_dependency('fastercsv', '~> 1.5') gem.add_runtime_dependency('multi_json', '~> 1.0') - gem.add_runtime_dependency('json', '~> 1.6') gem.add_runtime_dependency('stringex', '~> 1.4') gem.add_runtime_dependency('uuidtools', '~> 2.1') gem.add_runtime_dependency('dm-core', '~> 1.2.0') diff --git a/lib/dm-types/enum.rb b/lib/dm-types/enum.rb index 256f1fb..86e025b 100644 --- a/lib/dm-types/enum.rb +++ b/lib/dm-types/enum.rb @@ -41,7 +41,10 @@ def typecast_to_primitive(value) case flag_map[1] when ::Symbol then value.to_sym when ::String then value.to_s - when ::Fixnum then value.to_i + # Fixnum was unified into Integer in Ruby 2.4 and the constant was + # removed in Ruby 3.2; match ::Integer so this `when` clause keeps + # working (every former Fixnum is an Integer). + when ::Integer then value.to_i else value end end