diff options
| -rw-r--r-- | state.rb | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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 |
