summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--state.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/state.rb b/state.rb
index c8a39b2..5ebedea 100644
--- a/state.rb
+++ b/state.rb
@@ -116,10 +116,10 @@ class State
# type State to establish that said state depends on this one, or one of
# <tt>:user</tt> or <tt>:system</tt> to establish that the user or system
# has an interest in keeping this service running
- def hold(hold)
+ def hold(hold, params = {})
hold = Hold::Dep.new(hold) if hold.is_a? State
- hold = Hold::User.new if hold == :user
- hold = Hold::System.new if hold == :system
+ hold = Hold::User.new(params) if hold == :user
+ hold = Hold::System.new(params) if hold == :system
raise TypeError unless hold.is_a? Hold
trace "#{self} being held with #{hold}"
@holds.add hold
@@ -128,10 +128,10 @@ class State
end
# Release a hold on this state. Arguments are the same as for +hold+.
- def release(hold)
+ def release(hold, params = {})
hold = Hold::Dep.new(hold) if hold.is_a? State
- hold = Hold::User.new if hold == :user
- hold = Hold::System.new if hold == :system
+ hold = Hold::User.new(params) if hold == :user
+ hold = Hold::System.new(params) if hold == :system
raise TypeError unless hold.is_a? Hold
trace "#{self} being released from #{hold}"
@holds.delete hold
@@ -263,13 +263,13 @@ class State
end
# Hold all states of a class
- def State.hold(type)
- @@states.select{ |x| x.is_a? self }.map{ |x| x.hold(type) }
+ def State.hold(type, params = {})
+ @@states.select{ |x| x.is_a? self }.map{ |x| x.hold(type, params) }
end
# Release all states of a class
- def State.release(type)
- @@states.select{ |x| x.is_a? self }.map{ |x| x.release(type) }
+ def State.release(type, params = {})
+ @@states.select{ |x| x.is_a? self }.map{ |x| x.release(type, params) }
end
private