Class: Wf::CaseCommand::LockToken
- Inherits:
-
Object
- Object
- Wf::CaseCommand::LockToken
- Includes:
- SimpleCommand
- Defined in:
- app/models/wf/case_command/lock_token.rb
Instance Attribute Summary collapse
-
#place ⇒ Object
readonly
Returns the value of attribute place.
-
#wf_case ⇒ Object
readonly
Returns the value of attribute wf_case.
-
#workitem ⇒ Object
readonly
Returns the value of attribute workitem.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(wf_case, place, workitem) ⇒ LockToken
constructor
A new instance of LockToken.
Constructor Details
#initialize(wf_case, place, workitem) ⇒ LockToken
Returns a new instance of LockToken.
7 8 9 10 11 |
# File 'app/models/wf/case_command/lock_token.rb', line 7 def initialize(wf_case, place, workitem) @wf_case = wf_case @place = place @workitem = workitem end |
Instance Attribute Details
#place ⇒ Object (readonly)
Returns the value of attribute place.
6 7 8 |
# File 'app/models/wf/case_command/lock_token.rb', line 6 def place @place end |
#wf_case ⇒ Object (readonly)
Returns the value of attribute wf_case.
6 7 8 |
# File 'app/models/wf/case_command/lock_token.rb', line 6 def wf_case @wf_case end |
#workitem ⇒ Object (readonly)
Returns the value of attribute workitem.
6 7 8 |
# File 'app/models/wf/case_command/lock_token.rb', line 6 def workitem @workitem end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/wf/case_command/lock_token.rb', line 13 def call wf_case.tokens.free.where(place: place).limit(1).update_all( state: :locked, locked_at: Time.zone.now, locked_workitem_id: workitem.id ) end |