From 1104b6671251dfa72427210e6336c0c01dc23b5f Mon Sep 17 00:00:00 2001 From: yui-knk Date: Mon, 30 May 2016 00:39:56 +0900 Subject: [PATCH] Support for unified Integer class in Ruby 2.4+ Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 Ruby ~2.3 `1234.class` is `Fixnum` and `123456789012345678901234567890.class` is `Bignum`. Ruby 2.4+ `1234.class` is `Integer` and `123456789012345678901234567890.class` is `Integer`. So what we should do is defining `visit_Integer` method to visitors. --- lib/arel/visitors/depth_first.rb | 1 + lib/arel/visitors/dot.rb | 1 + lib/arel/visitors/to_sql.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/arel/visitors/depth_first.rb b/lib/arel/visitors/depth_first.rb index d7d85cfc..b0119e22 100644 --- a/lib/arel/visitors/depth_first.rb +++ b/lib/arel/visitors/depth_first.rb @@ -128,6 +128,7 @@ def terminal o alias :visit_FalseClass :terminal alias :visit_Fixnum :terminal alias :visit_Float :terminal + alias :visit_Integer :terminal alias :visit_NilClass :terminal alias :visit_String :terminal alias :visit_Symbol :terminal diff --git a/lib/arel/visitors/dot.rb b/lib/arel/visitors/dot.rb index e0c02d71..745f5b32 100644 --- a/lib/arel/visitors/dot.rb +++ b/lib/arel/visitors/dot.rb @@ -200,6 +200,7 @@ def visit_String o alias :visit_TrueClass :visit_String alias :visit_FalseClass :visit_String alias :visit_Arel_Nodes_BindParam :visit_String + alias :visit_Integer :visit_String alias :visit_Fixnum :visit_String alias :visit_BigDecimal :visit_String alias :visit_Float :visit_String diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index c50385ce..97490ef3 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -726,6 +726,7 @@ def visit_Arel_Nodes_BindParam o, collector alias :visit_Arel_Nodes_SqlLiteral :literal alias :visit_Bignum :literal alias :visit_Fixnum :literal + alias :visit_Integer :literal def quoted o, a quote(o, column_for(a))