diff options
| author | Masahiro Saito <camelmasa@gmail.com> | 2017-01-06 21:45:16 +0900 |
|---|---|---|
| committer | Daniel Doubrovkine (dB.) @dblockdotorg <dblock@dblock.org> | 2017-01-06 07:45:16 -0500 |
| commit | 87582b589fe04a9f0433478997d42aa8fa798144 (patch) | |
| tree | 248c1f76d3bb295a691e39d8b35bb00f186c67c1 /lib/hashie/extensions | |
| parent | 199d816bc0865d4276a1b6db669ef9f3a2fedfc1 (diff) | |
| download | hashie-87582b589fe04a9f0433478997d42aa8fa798144.tar.gz | |
Support Ruby 2.4.0 (#389)
Diffstat (limited to 'lib/hashie/extensions')
| -rw-r--r-- | lib/hashie/extensions/coercion.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/hashie/extensions/coercion.rb b/lib/hashie/extensions/coercion.rb index 962f94f..eb0a6dd 100644 --- a/lib/hashie/extensions/coercion.rb +++ b/lib/hashie/extensions/coercion.rb @@ -12,10 +12,14 @@ module Hashie Symbol => :to_sym } - ABSTRACT_CORE_TYPES = { - Integer => [Fixnum, Bignum], - Numeric => [Fixnum, Bignum, Float, Complex, Rational] - } + ABSTRACT_CORE_TYPES = if RubyVersion.new(RUBY_VERSION) >= RubyVersion.new('2.4.0') + { Numeric => [Integer, Float, Complex, Rational] } + else + { + Integer => [Fixnum, Bignum], + Numeric => [Fixnum, Bignum, Float, Complex, Rational] + } + end def self.included(base) base.send :include, InstanceMethods |
