From ba66dc49f592446dd3e09484397e900101b846ec Mon Sep 17 00:00:00 2001 From: 007lva Date: Sun, 3 May 2020 02:16:16 +0200 Subject: [PATCH 1/3] Replace Fixnum and Bignum with Integer --- lib/sprockets/digest_utils.rb | 12 +----------- lib/sprockets/loader.rb | 2 +- lib/sprockets/processor_utils.rb | 5 +++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/sprockets/digest_utils.rb b/lib/sprockets/digest_utils.rb index 7053d48a0..b66703a7a 100644 --- a/lib/sprockets/digest_utils.rb +++ b/lib/sprockets/digest_utils.rb @@ -68,18 +68,8 @@ def detect_digest_class(bytes) Encoding => ->(val, digest) { digest << 'Encoding'.freeze digest << val.name - }, - } - if 0.class != Integer # Ruby < 2.4 - ADD_VALUE_TO_DIGEST[Fixnum] = ->(val, digest) { - digest << 'Integer'.freeze - digest << val.to_s } - ADD_VALUE_TO_DIGEST[Bignum] = ->(val, digest) { - digest << 'Integer'.freeze - digest << val.to_s - } - end + } ADD_VALUE_TO_DIGEST.compare_by_identity.rehash diff --git a/lib/sprockets/loader.rb b/lib/sprockets/loader.rb index 08e4866da..e8c044e60 100644 --- a/lib/sprockets/loader.rb +++ b/lib/sprockets/loader.rb @@ -289,7 +289,7 @@ def resolve_dependencies(uris) # Internal: Retrieves an asset based on its digest # # unloaded - An UnloadedAsset - # limit - A Fixnum which sets the maximum number of versions of "histories" + # limit - A Integer which sets the maximum number of versions of "histories" # stored in the cache # # This method attempts to retrieve the last `limit` number of histories of an asset diff --git a/lib/sprockets/processor_utils.rb b/lib/sprockets/processor_utils.rb index 9d2943c38..d019667e4 100644 --- a/lib/sprockets/processor_utils.rb +++ b/lib/sprockets/processor_utils.rb @@ -118,8 +118,9 @@ def processors_cache_keys(processors) Symbol, TrueClass, FalseClass, - NilClass - ] + (0.class == Integer ? [Integer] : [Bignum, Fixnum])).freeze + NilClass, + Integer + ]).freeze # Internal: Set of all nested compound metadata types that can nest values. VALID_METADATA_COMPOUND_TYPES = Set.new([ From aabdf606933425cc36701cb8b7a16a94e7f43304 Mon Sep 17 00:00:00 2001 From: 007lva Date: Sun, 3 May 2020 02:27:06 +0200 Subject: [PATCH 2/3] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ef859ab9..99619f68f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprocket ## Master - Fix for Ruby 2.7 keyword arguments warning in `base.rb`. [#660](https://github.com/rails/sprockets/pull/660) +- Remove remaining support for Ruby < 2.4.[#672](https://github.com/rails/sprockets/pull/672) ## 4.0.0 From a03af72f46a7b13bf0fac188142d20c372573b41 Mon Sep 17 00:00:00 2001 From: 007lva Date: Sun, 14 Jun 2020 22:32:26 +0200 Subject: [PATCH 3/3] Fix typo --- lib/sprockets/loader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sprockets/loader.rb b/lib/sprockets/loader.rb index d7ba54e95..60284f8e7 100644 --- a/lib/sprockets/loader.rb +++ b/lib/sprockets/loader.rb @@ -291,7 +291,7 @@ def resolve_dependencies(uris) # Internal: Retrieves an asset based on its digest # # unloaded - An UnloadedAsset - # limit - A Integer which sets the maximum number of versions of "histories" + # limit - An Integer which sets the maximum number of versions of "histories" # stored in the cache # # This method attempts to retrieve the last `limit` number of histories of an asset