diff options
author | Koichi ITO <koic.ito@gmail.com> | 2020-01-15 13:12:09 +0900 |
---|---|---|
committer | Koichi ITO <koic.ito@gmail.com> | 2020-01-16 10:58:05 +0900 |
commit | 4d3d06268068b3832dcf1e384ce6f95f1a759248 (patch) | |
tree | f79fed7234a14b0e15829cceeff8d13b5183e1ab /lib/hashie | |
parent | ac155745825af0fbb1b46c38f1d2f903e6e04fb1 (diff) | |
download | hashie-4d3d06268068b3832dcf1e384ce6f95f1a759248.tar.gz |
Suppress an integer unification warning for Ruby 2.4.0+
This PR suppresss the following integer unification warning
for Ruby 2.4.0+
```console
% ruby -v
ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-darwin17]
% bundle exec rspec spec/hashie/extensions/deep_merge_spec.rb
Hashie::Extensions::DeepMerge
/Users/koic/src/github.com/hahie/hashie/lib/hashie/utils.rb:38: warning:
constant ::Fixnum is deprecated
/Users/koic/src/github.com/hahie/hashie/lib/hashie/utils.rb:38: warning:
constant ::Bignum is deprecated
```
Diffstat (limited to 'lib/hashie')
-rw-r--r-- | lib/hashie/extensions/dash/property_translation.rb | 2 | ||||
-rw-r--r-- | lib/hashie/utils.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/hashie/extensions/dash/property_translation.rb b/lib/hashie/extensions/dash/property_translation.rb index c0fd009..8149faa 100644 --- a/lib/hashie/extensions/dash/property_translation.rb +++ b/lib/hashie/extensions/dash/property_translation.rb @@ -35,7 +35,7 @@ module Hashie # end # # model = DataModelHash.new(id: '123', created: '2014-04-25 22:35:28') - # model.id.class #=> Fixnum + # model.id.class #=> Integer (Fixnum if you are using Ruby 2.3 or lower) # model.created_at.class #=> Time module PropertyTranslation def self.included(base) diff --git a/lib/hashie/utils.rb b/lib/hashie/utils.rb index 5b55b9a..9dc6294 100644 --- a/lib/hashie/utils.rb +++ b/lib/hashie/utils.rb @@ -34,10 +34,10 @@ module Hashie # @return [Array<Class>] def self.integer_classes @integer_classes ||= - if const_defined?(:Fixnum) - [Fixnum, Bignum] # rubocop:disable Lint/UnifiedInteger - else + if 0.class == Integer [Integer] + else + [Fixnum, Bignum] # rubocop:disable Lint/UnifiedInteger end end end |