module Arel::Visitors::ArJdbcCompat

Public Class Methods

limit_for(limit_or_node) click to toggle source
# File lib/arel/visitors/compat.rb, line 27
def limit_for(limit_or_node)
  if limit_or_node.respond_to?(:expr)
    expr = limit_or_node.expr
    # NOTE(uwe): Different behavior for Arel 6.0.0 and 6.0.2
    expr.respond_to?(:value) ? expr.value.to_i : expr.to_i
  else
    limit_or_node
  end
end

Protected Instance Methods

do_visit(x, a) click to toggle source
# File lib/arel/visitors/compat.rb, line 8
def do_visit(x, a); visit(x); end
do_visit_select_core(x, a) click to toggle source
# File lib/arel/visitors/compat.rb, line 14
def do_visit_select_core(x, a) # a = nil
  visit_Arel_Nodes_SelectCore(x)
end

Private Instance Methods

limit_for(limit_or_node) click to toggle source
# File lib/arel/visitors/compat.rb, line 27
def limit_for(limit_or_node)
  if limit_or_node.respond_to?(:expr)
    expr = limit_or_node.expr
    # NOTE(uwe): Different behavior for Arel 6.0.0 and 6.0.2
    expr.respond_to?(:value) ? expr.value.to_i : expr.to_i
  else
    limit_or_node
  end
end
node_value(node) click to toggle source
# File lib/arel/visitors/compat.rb, line 48
def node_value(node)
  return nil unless node
  case expr = node.expr
    when NilClass then nil
    when Numeric then expr
    when Arel::Nodes::Unary then expr.expr
  end
end