Skip to content

Commit

Permalink
Merge pull request #672 from 007lva/chore/replace-Fixnum-and-Bignum-w…
Browse files Browse the repository at this point in the history
…ith-Integer

Drop support for Ruby 2.3
  • Loading branch information
rafaelfranca authored Jul 6, 2020
2 parents 8fc492a + a03af72 commit dba2802
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md

## Master

- Remove remaining support for Ruby < 2.4.[#672](https://github.com/rails/sprockets/pull/672)

## 4.0.2

- Fix `etag` and digest path compilation that were generating string with invalid digest since 4.0.1.
Expand Down
12 changes: 1 addition & 11 deletions lib/sprockets/digest_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/sprockets/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,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 - 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
Expand Down
5 changes: 3 additions & 2 deletions lib/sprockets/processor_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit dba2802

Please sign in to comment.