lib/sequel/extensions/date_arithmetic.rb in sequel-4.30.0 vs lib/sequel/extensions/date_arithmetic.rb in sequel-4.31.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen-string-literal: true
+#
# The date_arithmetic extension adds the ability to perform database-independent
# addition/substraction of intervals to/from dates and timestamps.
#
# First, you need to load the extension into the database:
#
@@ -71,10 +73,10 @@
end
h = da.interval
expr = da.expr
cast = case db_type = db.database_type
when :postgres
- interval = ""
+ interval = String.new
each_valid_interval_unit(h, DEF_DURATION_UNITS) do |value, sql_unit|
interval << "#{value} #{sql_unit} "
end
if interval.empty?
return literal_append(sql, Sequel.cast(expr, Time))