title: How to refactor this method?
body: <p>I've written a method to merge a date interval with another date interval if the start of interval is equal to the end of the other interval.</p>
  
  <pre><code>def merge
    slots.each do |slot|
      if self.start == slot.end
        slot.end = self.end
        slot.save
        return self
      elsif self.end == slot.start
        slot.start = self.start
        slot.save
        return self
      end
    end
    self.save
  end
  </code></pre>
  
  <p><code>self</code> is the interval that I want to merge it with any of the intervals that exist in the <code>slots</code> array. 
  What is the best way to refactor this method?</p>
  
  <p>I tried to turn it into something like this with no success:</p>
  
  <pre><code>def merge
    slots.each do |slot|
      if slot.one_bound == slot.other_bound
        slot.other_bound = self.other_bound
        slot.save
        return self
      end
    end
    self.save
  end
  </code></pre>