Permalink
Browse files

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.
1 parent cff88ea commit dc85a6e9c74942945ad696f5da4d82490a85b865 @yui-knk yui-knk committed May 29, 2016
Showing with 3 additions and 0 deletions.
  1. +1 −0 lib/arel/visitors/depth_first.rb
  2. +1 −0 lib/arel/visitors/dot.rb
  3. +1 −0 lib/arel/visitors/to_sql.rb
@@ -141,6 +141,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
@@ -205,6 +205,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
@@ -762,6 +762,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
if a && a.able_to_type_cast?

0 comments on commit dc85a6e

Please sign in to comment.