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