Skip to content

Commit

Permalink
Remove dead code for date_arithmetic extension
Browse files Browse the repository at this point in the history
The -interval has not been needed since the interval = interval.parts
was added above it.
  • Loading branch information
jeremyevans committed Jan 29, 2021
1 parent a6bde6f commit 8690f70
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/sequel/extensions/date_arithmetic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,10 @@ def date_sub(expr, interval, opts=OPTS)
if defined?(ActiveSupport::Duration) && interval.is_a?(ActiveSupport::Duration)
interval = interval.parts
end
interval = if interval.is_a?(Enumerable)
h = {}
interval.each{|k,v| h[k] = -v unless v.nil?}
h
else
-interval
end
DateAdd.new(expr, interval, opts)
parts = {}
interval.each{|k,v| parts[k] = -v unless v.nil?}
parts
DateAdd.new(expr, parts, opts)
end
end

Expand Down

0 comments on commit 8690f70

Please sign in to comment.