From 142da7c7eb3df5487cfd65ad2b1482672a54c7ed Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 10 May 2023 16:50:11 +0200 Subject: [PATCH] deduplicate convert_to_node --- lib/arel_extensions/predications.rb | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/arel_extensions/predications.rb b/lib/arel_extensions/predications.rb index 72d99d78..f4fc8c0f 100644 --- a/lib/arel_extensions/predications.rb +++ b/lib/arel_extensions/predications.rb @@ -75,26 +75,5 @@ def not_in(*other) # In should handle nil element in the Array Arel::Nodes::NotIn.new(self, quoted_node(other)) end end - - def convert_to_node(object) - case object - when Arel::Attributes::Attribute, Arel::Nodes::Node, Integer - object - when DateTime - Arel.quoted(object, self) - when Time - Arel.quoted(object.strftime('%H:%M:%S'), self) - when String - Arel.quoted(object) - when Date - Arel.quoted(object.to_s, self) - when NilClass - Arel.sql('NULL') - when ActiveSupport::Duration - object.to_i - else - raise(ArgumentError, "#{object.class} cannot be converted to CONCAT arg") - end - end end end