From cccfc879a4e45f3dccecd99533d6dbeb9b2a53b2 Mon Sep 17 00:00:00 2001 From: Casey Dahlin Date: Fri, 10 Oct 2008 16:38:26 -0400 Subject: Better release comparison State#release will now release all holds which match (should be rare) and matches holds more correctly. --- state.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/state.rb b/state.rb index c1f6c9f..b82b81f 100644 --- a/state.rb +++ b/state.rb @@ -155,11 +155,12 @@ class State # Release a hold on this state. Arguments are the same as for +hold+. def release(hold, params = {}) + return if @holds.size == 0 hold = Hold::Dep.new(hold) if hold.is_a? State hold = Hold::User.new(params) if hold == :user hold = Hold::System.new(params) if hold == :system raise TypeError unless hold.is_a? Hold - @holds.delete hold + @holds.reject!{ |x| hold == x } drop if @holds.size == 0 self end -- cgit