Remove Fixnum references to support modern Ruby versions

Fixnum type has been deprecated since Ruby 2.4 and removed in Ruby 3.0,
which makes BaseProtocol incompatible with modern Ruby versions.

This change removes the Fixnum reference, as well as a monkey-patch that
introduces Fixnum#ord() to Ruby versions below 1.8.7.

**This change essentially makes it officially required to use Ruby 2.4 or newer.**

Fixes the following test failures:

  1) BaseProtocol Thrift::BaseProtocol should write out the different types (deprecated write_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:65:in 'block (3 levels) in <top (required)>'

  2) BaseProtocol Thrift::BaseProtocol should write out the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:90:in 'block (3 levels) in <top (required)>'

  3) BaseProtocol Thrift::BaseProtocol should read the different types (deprecated read_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:113:in 'block (3 levels) in <top (required)>'

  4) BaseProtocol Thrift::BaseProtocol should read the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:136:in 'block (3 levels) in <top (required)>'
diff --git a/lib/rb/lib/thrift.rb b/lib/rb/lib/thrift.rb
index 0f58122..5d83695 100644
--- a/lib/rb/lib/thrift.rb
+++ b/lib/rb/lib/thrift.rb
@@ -23,7 +23,6 @@
 $:.unshift File.dirname(__FILE__)
 
 require 'thrift/bytes'
-require 'thrift/core_ext'
 require 'thrift/exceptions'
 require 'thrift/types'
 require 'thrift/processor'
diff --git a/lib/rb/lib/thrift/core_ext.rb b/lib/rb/lib/thrift/core_ext.rb
deleted file mode 100644
index f763cd5..0000000
--- a/lib/rb/lib/thrift/core_ext.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].each do |file|
-  name = File.basename(file, '.rb')
-  require "thrift/core_ext/#{name}"
-end
diff --git a/lib/rb/lib/thrift/core_ext/fixnum.rb b/lib/rb/lib/thrift/core_ext/fixnum.rb
deleted file mode 100644
index b4fc90d..0000000
--- a/lib/rb/lib/thrift/core_ext/fixnum.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# 
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Versions of ruby pre 1.8.7 do not have an .ord method available in the Fixnum
-# class.
-#
-if RUBY_VERSION < "1.8.7"
-  class Fixnum
-    def ord
-      self
-    end
-  end
-end
\ No newline at end of file
diff --git a/lib/rb/lib/thrift/protocol/base_protocol.rb b/lib/rb/lib/thrift/protocol/base_protocol.rb
index 4d83a21..e9ea7c2 100644
--- a/lib/rb/lib/thrift/protocol/base_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/base_protocol.rb
@@ -251,9 +251,9 @@
     #
     # Returns nothing.
     def write_type(field_info, value)
-      # if field_info is a Fixnum, assume it is a Thrift::Types constant
+      # if field_info is a Integer, assume it is a Thrift::Types constant
       # convert it into a field_info Hash for backwards compatibility
-      if field_info.is_a? Fixnum
+      if field_info.is_a? Integer
         field_info = {:type => field_info}
       end
 
@@ -291,9 +291,9 @@
     #
     # Returns the value read; object type varies based on field_info[:type].
     def read_type(field_info)
-      # if field_info is a Fixnum, assume it is a Thrift::Types constant
+      # if field_info is a Integer, assume it is a Thrift::Types constant
       # convert it into a field_info Hash for backwards compatibility
-      if field_info.is_a? Fixnum
+      if field_info.is_a? Integer
         field_info = {:type => field_info}
       end
 
diff --git a/lib/rb/lib/thrift/transport/base_transport.rb b/lib/rb/lib/thrift/transport/base_transport.rb
index 97e5935..12dd673 100644
--- a/lib/rb/lib/thrift/transport/base_transport.rb
+++ b/lib/rb/lib/thrift/transport/base_transport.rb
@@ -62,7 +62,7 @@
       raise NotImplementedError
     end
 
-    # Returns an unsigned byte as a Fixnum in the range (0..255).
+    # Returns an unsigned byte as a Integer in the range (0..255).
     def read_byte
       buf = read_all(1)
       return Bytes.get_string_byte(buf, 0)
diff --git a/lib/rb/spec/struct_spec.rb b/lib/rb/spec/struct_spec.rb
index bbd502b..9a4baa8 100644
--- a/lib/rb/spec/struct_spec.rb
+++ b/lib/rb/spec/struct_spec.rb
@@ -227,7 +227,7 @@
     it "should support optional type-checking in Thrift::Struct.new" do
       Thrift.type_checking = true
       begin
-        expect { SpecNamespace::Hello.new(:greeting => 3) }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
+        expect { SpecNamespace::Hello.new(:greeting => 3) }.to raise_error(Thrift::TypeError, "Expected Types::STRING, received Integer for field greeting")
       ensure
         Thrift.type_checking = false
       end
@@ -238,7 +238,7 @@
       Thrift.type_checking = true
       begin
         hello = SpecNamespace::Hello.new
-        expect { hello.greeting = 3 }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
+        expect { hello.greeting = 3 }.to raise_error(Thrift::TypeError, "Expected Types::STRING, received Integer for field greeting")
       ensure
         Thrift.type_checking = false
       end
diff --git a/lib/rb/spec/types_spec.rb b/lib/rb/spec/types_spec.rb
index d595ab5..a385367 100644
--- a/lib/rb/spec/types_spec.rb
+++ b/lib/rb/spec/types_spec.rb
@@ -100,9 +100,9 @@
     end
 
     it "should give the Thrift::TypeError a readable message" do
-      msg = /Expected Types::STRING, received (Integer|Fixnum) for field foo/
+      msg = "Expected Types::STRING, received Integer for field foo"
       expect { Thrift.check_type(3, {:type => Thrift::Types::STRING}, :foo) }.to raise_error(Thrift::TypeError, msg)
-      msg = /Expected Types::STRING, received (Integer|Fixnum) for field foo.element/
+      msg = "Expected Types::STRING, received Integer for field foo.element"
       field = {:type => Thrift::Types::LIST, :element => {:type => Thrift::Types::STRING}}
       expect { Thrift.check_type([3], field, :foo) }.to raise_error(Thrift::TypeError, msg)
       msg = "Expected Types::I32, received NilClass for field foo.element.key"
diff --git a/lib/rb/thrift.gemspec b/lib/rb/thrift.gemspec
index 7e1bb33..d763bad 100644
--- a/lib/rb/thrift.gemspec
+++ b/lib/rb/thrift.gemspec
@@ -12,6 +12,8 @@
   s.license     = 'Apache-2.0'
   s.extensions  = ['ext/extconf.rb']
 
+  s.required_ruby_version = '>= 2.4.0'
+
   s.rdoc_options  = %w[--line-numbers --inline-source --title Thrift --main README]
 
   dir = File.expand_path(File.dirname(__FILE__))