Skip to content

Commit

Permalink
return Delayed::Priority from add/subtract, add #to_d
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoar committed Apr 5, 2024
1 parent f3aac3e commit 8436715
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/delayed/priority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,17 @@ def <=>(other)
end

def -(other)
to_i - other.to_i
other = other.to_i if other.is_a?(self.class)
self.class.new(to_i - other)
end

def +(other)
to_i + other.to_i
other = other.to_i if other.is_a?(self.class)
self.class.new(to_i + other)
end

def to_d
to_i.to_d
end

private
Expand Down

0 comments on commit 8436715

Please sign in to comment.